/* * Copyright (c) 2019-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ namespace deduplication { struct A { int f; }; template struct SomeTemplatedClass { void templated_wrapper_delete_ok(A* a); void templated_wrapper_access_ok(A* a); void lifetime_error_bad(A* a); }; template void SomeTemplatedClass::templated_wrapper_delete_ok(A* a) { delete a; } template void SomeTemplatedClass::templated_wrapper_access_ok(A* a) { int x = a->f; } template void SomeTemplatedClass::lifetime_error_bad(A* a) { SomeTemplatedClass::templated_wrapper_delete_ok(a); SomeTemplatedClass::templated_wrapper_access_ok(a); } void materialize_template_instances() { A* a1 = new A(); SomeTemplatedClass x1; x1.lifetime_error_bad(a1); A* a2 = new A(); SomeTemplatedClass x2; x2.lifetime_error_bad(a2); } } // namespace deduplication