comparison gcc/testsuite/g++.dg/cpp1z/constexpr-if12.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 // PR c++/80562 1 // PR c++/80562
2 // { dg-do compile { target c++17 } } 2 // { dg-do compile { target c++17 } }
3 3
4 struct T { 4 struct T {
5 int i;
5 constexpr auto foo() { return false; } 6 constexpr auto foo() { return false; }
6 }; 7 };
7 8
8 template <class MustBeTemplate> 9 template <class MustBeTemplate>
9 constexpr auto bf(T t) { 10 constexpr auto bf(T t) {
10 if constexpr(t.foo()) { // { dg-error "constant expression" } 11 if constexpr(t.foo()) {
11 return false; 12 return false;
12 } 13 }
13 return true; 14 return true;
14 } 15 }