summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp1z/constexpr-if2.C
blob: 7f3a5776c42f4b8e6567b2da10050f3d155918ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// { dg-do compile { target c++14 } }
// { dg-options "" }

template <class,class> struct Same;
template <class T> struct Same<T,T> {};

auto f()
{
  if constexpr (sizeof(int)==3) // { dg-warning "constexpr" "" { target c++14_only } }
    return 42;
  else
    return 42L;
}

Same<decltype(f()), long> s;