/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ namespace class_specialization { template struct Base { T x; }; template struct Derived : public Base { void foo(T t) { this->x = t; } }; template struct Derived : public Base { void foo2(T* t) { this->x = t; } }; void foo_intptr() { Derived b; b.foo2(nullptr); int x = *b.x; } void foo_int() { Derived b; b.foo(0); int z = 1 / b.x; } } // namespace class_specialization