Debian Codegraph @

gcc/testsuite/g++.dg/warn/pr94038-2.C

raw
1 // PR c++/94038
2 // { dg-do compile { target c++11 } }
3 // { dg-additional-options "-O -Wall" }
4
5 static constexpr int x = 0;
6
7 template<typename T>
8 constexpr const int&
9 foo()
10 {
11 static_assert(T(1) == 0, "");
12 return x;
13 }
14
15 template<typename T>
16 constexpr const int&
17 bar()
18 {
19 return foo<T>();
20 }
21
22 constexpr int
23 baz(int a)
24 {
25 return a;
26 }
27
28 static_assert(decltype(baz(bar<int>())){} == 0, "");