Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/g++.old-deja/g++.jason/template27.C @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children |
line wrap: on
line source
// { dg-do run } // PRMS Id: 6826 // Check that unnecessary templates are not instantiated. template <class T> class Test { public: void doThiss(); void doThat(); }; template <class T> void Test<T>::doThiss() { T x; x.thiss(); } template <class T> void Test<T>::doThat() { T x; x.that(); } class A { public: void thiss() {} }; class B { public: void that() {} }; int main() { Test<A> a; a.doThiss(); // a.doThat() is not well formed, but then // it's not used so needn't be instantiated. Test<B> b; b.doThat(); // simillarly b.doThiss(); }