11// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -Wno-c99-designator %s
2+ // RUN: %clang_cc1 -std=c++17 -fsyntax-only -verify -Wno-c99-designator %s
23
34// PR5290
45int const f0 ();
@@ -156,35 +157,20 @@ struct A {
156157 }
157158};
158159
159- // This shouldn't crash.
160- static_assert (A<int >().f<int >() == 0 , " " );
161- // The result should not be dependent.
162- static_assert (A<int >().f<int >() != 0 , " " ); // expected-error {{static assertion failed due to requirement 'GH99873::A<int>().f<int>() != 0'}}
163- // expected-note@-1 {{expression evaluates to '0 != 0'}}
164- }
165-
166- template <typename >
167- class conditional {
168- };
169-
170- // FIXME: The diagnostics here are produced twice.
171- void foo (conditional<decltype ((1 ),int>) { // expected-note 2 {{to match this '('}} expected-error {{expected ')'}} expected-note 2{{to match this '<'}}
172- } // expected-error {{expected function body after function declarator}} expected-error 2 {{expected '>'}} expected-error {{expected ')'}}
173-
174-
160+ #if __cplusplus >= 201703L
175161namespace GH160497 {
176162
177163template <class > struct S {
178164 template <class >
179- inline static auto mem =
165+ static inline auto mem =
180166 [] { static_assert (false ); // expected-error {{static assertion failed}} \
181167 // expected-note {{while substituting into a lambda expression here}}
182168 return 42 ;
183169 }();
184170};
185171
186172using T = decltype (S<void >::mem<void >);
187- // expected-note@-1 {{in instantiation of static data member 'GH160497::S<void>::mem<void>' requested here}}
173+ // expected-note@-1 {{in instantiation of static data member 'GH99873:: GH160497::S<void>::mem<void>' requested here}}
188174
189175namespace N1 {
190176
@@ -200,3 +186,19 @@ T y = 42;
200186
201187}
202188}
189+ #endif
190+
191+ // This shouldn't crash.
192+ static_assert (A<int >().f<int >() == 0 , " " );
193+ // The result should not be dependent.
194+ static_assert (A<int >().f<int >() != 0 , " " ); // expected-error {{static assertion failed due to requirement 'GH99873::A<int>().f<int>() != 0'}}
195+ // expected-note@-1 {{expression evaluates to '0 != 0'}}
196+ }
197+
198+ template <typename >
199+ class conditional {
200+ };
201+
202+ // FIXME: The diagnostics here are produced twice.
203+ void foo (conditional<decltype ((1 ),int>) { // expected-note 2 {{to match this '('}} expected-error {{expected ')'}} expected-note 2{{to match this '<'}}
204+ } // expected-error {{expected function body after function declarator}} expected-error 2 {{expected '>'}} expected-error {{expected ')'}}
0 commit comments