brintos

brintos / llvm-project-archived public Read only

0
0
Text · 922 B · bf99a53 Raw
34 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify -std=c++23 %s2 3namespace GH63627 {4template<class T>5void ok() {6  if  (using U = decltype([]{ return 42;}); true) {7      static_assert(U{}() == 42);8  }9  for (using U = decltype([]{ return 42;}); [[maybe_unused]] auto x : "abc") {10      static_assert(U{}() == 42);11  }12  for (using U = decltype([]{ return 42;}); false; ) {13      static_assert(U{}() == 42);14  }15}16 17template<class T>18void err() {19  if  (using U = decltype([]{}.foo); true) {}  // expected-error {{no member named 'foo'}}20 21  for (using U = decltype([]{}.foo);          // expected-error {{no member named 'foo'}}22       [[maybe_unused]] auto x : "abc") { }23 24  for (using U = decltype([]{}.foo);          // expected-error {{no member named 'foo'}}25       false ; ) { }26};27 28void test() {29  ok<int>();30  err<int>(); // expected-note {{in instantiation of function template specialization 'GH63627::err<int>'}}31}32 33}34