/cp
[official-gcc.git] / gcc / testsuite / g++.dg / cpp1y / constexpr-instantiate.C
blob84707b9e8696ea4d62360f030063fe9a84977a77
1 // PR c++/58281 - Problem with explicitly instantiated constexpr template
2 //     functions 
3 // { dg-do compile { target c++11 } }
4 // { dg-options "-fdump-tree-optimized" }
7 template <typename T>
8 constexpr bool f (T a)
10   return a == 3;
13 extern template bool f<int>(int);
15 bool g (int x) { return f (x); }
17 template bool f<int>(int);
19 // Verify that the defintions of both f() and g() are emitted.
20 // { dg-final { scan-tree-dump-times ";; Function f" 1 "optimized" } }
21 // { dg-final { scan-tree-dump-times ";; Function g" 1 "optimized" } }