- Allow abstract parameter and return types in functions that are
either deleted or not defined.
(`#63012 <https://github.com/llvm/llvm-project/issues/63012>`_)
+- Fix handling of using-declarations in the init statements of for
+ loop declarations.
+ (`#63627 <https://github.com/llvm/llvm-project/issues/63627>`_)
Bug Fixes to AST Handling
^^^^^^^^^^^^^^^^^^^^^^^^^
Diag(Tok, diag::warn_gcc_variable_decl_in_for_loop);
}
DeclGroupPtrTy DG;
+ SourceLocation DeclStart = Tok.getLocation(), DeclEnd;
if (Tok.is(tok::kw_using)) {
DG = ParseAliasDeclarationInInitStatement(DeclaratorContext::ForInit,
attrs);
+ FirstPart = Actions.ActOnDeclStmt(DG, DeclStart, Tok.getLocation());
} else {
// In C++0x, "for (T NS:a" might not be a typo for ::
bool MightBeForRangeStmt = getLangOpts().CPlusPlus;
ColonProtectionRAIIObject ColonProtection(*this, MightBeForRangeStmt);
-
- SourceLocation DeclStart = Tok.getLocation(), DeclEnd;
ParsedAttributes DeclSpecAttrs(AttrFactory);
DG = ParseSimpleDeclaration(
DeclaratorContext::ForInit, DeclEnd, attrs, DeclSpecAttrs, false,
--- /dev/null
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++23 %s
+
+namespace GH63627 {
+template<class T>
+void ok() {
+ if (using U = decltype([]{ return 42;}); true) {
+ static_assert(U{}() == 42);
+ }
+ for (using U = decltype([]{ return 42;}); [[maybe_unused]] auto x : "abc") {
+ static_assert(U{}() == 42);
+ }
+ for (using U = decltype([]{ return 42;}); false; ) {
+ static_assert(U{}() == 42);
+ }
+}
+
+template<class T>
+void err() {
+ if (using U = decltype([]{}.foo); true) {} // expected-error {{no member named 'foo'}}
+
+ for (using U = decltype([]{}.foo); // expected-error {{no member named 'foo'}}
+ [[maybe_unused]] auto x : "abc") { }
+
+ for (using U = decltype([]{}.foo); // expected-error {{no member named 'foo'}}
+ false ; ) { }
+};
+
+void test() {
+ ok<int>();
+ err<int>(); // expected-note {{in instantiation of function template specialization 'GH63627::err<int>'}}
+}
+
+}