Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/g++.dg/cpp2a/consteval7.C @ 152:2b5abeee2509
update gcc11
author | anatofuz |
---|---|
date | Mon, 25 May 2020 07:50:57 +0900 |
parents | 1830386684a0 |
children |
line wrap: on
line source
// { dg-do compile } // { dg-options "-std=c++2a" } consteval int foo () { return 42; } consteval auto bar () { return foo; } constexpr auto a = bar (); // { dg-error "immediate evaluation returns address of immediate function 'consteval int foo\\(\\)'" } struct S { int b; int (*c) (); }; consteval S baz () { return { 5, foo }; } consteval int qux () { S s = baz (); return s.b + s.c (); } consteval int quux () { constexpr S s = baz (); return s.b + s.c (); } constexpr auto d = baz (); // { dg-error "immediate evaluation returns address of immediate function 'consteval int foo\\(\\)'" } constexpr auto e = qux (); constexpr auto f = quux ();