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" }
5 
6 
7 template <typename T>
f(T a)8 constexpr bool f (T a)
9 {
10   return a == 3;
11 }
12 
13 extern template bool f<int>(int);
14 
g(int x)15 bool g (int x) { return f (x); }
16 
17 template bool f<int>(int);
18 
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" } }
22