Fortran: Fix PR 47485.
[gcc.git] / gcc / testsuite / g++.dg / cpp0x / constexpr-inst1.C
blob3ce513d6e256152b3203318dba2971891d499dc9
1 // Test that we don't uselessly instantiate f<A> immediately while parsing g.
2 // Doing so is permitted by the standard, but has no benefit and breaks code
3 // unnecessarily.
5 // { dg-do compile { target c++11 } }
7 // -O activates the call to maybe_constant_value in cp_fold.
8 // { dg-additional-options -O }
10 template <class T>
11 constexpr int f (const T* p) { return p->i; }
13 constexpr int g(const struct A* p) { return f(p); }
15 struct A { int i; };
17 // Instantiating f<A> at EOF works fine.