From 8496e135b111424e3c84f3f44c74f2cbe48eed90 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 7 Feb 2020 15:09:14 -0500 Subject: [PATCH] c++: Make PR92654 testcase valid. --- gcc/testsuite/g++.dg/cpp1z/constexpr-if-lambda2.C | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/gcc/testsuite/g++.dg/cpp1z/constexpr-if-lambda2.C b/gcc/testsuite/g++.dg/cpp1z/constexpr-if-lambda2.C index fb26ac716d4..192c82d34fd 100644 --- a/gcc/testsuite/g++.dg/cpp1z/constexpr-if-lambda2.C +++ b/gcc/testsuite/g++.dg/cpp1z/constexpr-if-lambda2.C @@ -1,12 +1,17 @@ // PR c++/92654 // { dg-do compile { target c++17 } } -template struct C; +struct A { + constexpr operator int () { return 42; } +}; +template struct C { + static const bool ap = I; +}; template void am() { [](auto an) { - if constexpr (C::ap) ; // { dg-error "constant" } - }(42); + if constexpr (C::ap) ; + }(A{}); } void fn() { am<42>(); } -- 2.30.2