Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / SemaCXX / cxx23-init-statement.cpp
blobbf99a53df15e1471e3f7d06a0ec11a80e43ecde0
1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++23 %s
3 namespace GH63627 {
4 template<class T>
5 void ok() {
6 if (using U = decltype([]{ return 42;}); true) {
7 static_assert(U{}() == 42);
9 for (using U = decltype([]{ return 42;}); [[maybe_unused]] auto x : "abc") {
10 static_assert(U{}() == 42);
12 for (using U = decltype([]{ return 42;}); false; ) {
13 static_assert(U{}() == 42);
17 template<class T>
18 void err() {
19 if (using U = decltype([]{}.foo); true) {} // expected-error {{no member named 'foo'}}
21 for (using U = decltype([]{}.foo); // expected-error {{no member named 'foo'}}
22 [[maybe_unused]] auto x : "abc") { }
24 for (using U = decltype([]{}.foo); // expected-error {{no member named 'foo'}}
25 false ; ) { }
28 void test() {
29 ok<int>();
30 err<int>(); // expected-note {{in instantiation of function template specialization 'GH63627::err<int>'}}