Skip to content

release/23.x: [Clang] Fixed auto parsing regression with brace initialization (#210347) - #210441

Merged
dyung merged 1 commit into
llvm:release/23.xfrom
llvmbot:issue210347
Jul 22, 2026
Merged

release/23.x: [Clang] Fixed auto parsing regression with brace initialization (#210347)#210441
dyung merged 1 commit into
llvm:release/23.xfrom
llvmbot:issue210347

Conversation

@llvmbot

@llvmbot llvmbot commented Jul 17, 2026

Copy link
Copy Markdown
Member

Backport d592aa5

Requested by: @to268

@llvmbot

llvmbot commented Jul 17, 2026

Copy link
Copy Markdown
Member Author

@cor3ntin @AaronBallman What do you think about merging this PR to the release branch?

@llvmbot
llvmbot requested review from AaronBallman and cor3ntin July 17, 2026 21:31
@llvmorg-github-actions llvmorg-github-actions Bot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Jul 17, 2026
@llvmorg-github-actions

Copy link
Copy Markdown

@llvm/pr-subscribers-clang

Author: llvmbot

Changes

Backport d592aa5

Requested by: @to268


Full diff: https://github.com/llvm/llvm-project/pull/210441.diff

2 Files Affected:

  • (modified) clang/lib/Parse/ParseDecl.cpp (+4-4)
  • (added) clang/test/CXX/dcl/dcl.spec/dcl.type/dcl.type.general/p2.cpp (+11)
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 88f07bb104fcb..0825678acaf60 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -3879,10 +3879,10 @@ void Parser::ParseDeclarationSpecifiers(
       // when a variable name matches a type brought in by a using-directive.
       if (DS.getTypeSpecType() == DeclSpec::TST_auto) {
         Token Next = NextToken();
-        if (Next.isOneOf(tok::equal, tok::l_paren, tok::l_square, tok::amp,
-                         tok::ampamp, tok::star, tok::coloncolon, tok::comma,
-                         tok::semi, tok::colon, tok::greater, tok::r_paren,
-                         tok::arrow))
+        if (Next.isOneOf(tok::equal, tok::l_paren, tok::l_square, tok::l_brace,
+                         tok::amp, tok::ampamp, tok::star, tok::coloncolon,
+                         tok::comma, tok::semi, tok::colon, tok::greater,
+                         tok::r_paren, tok::arrow))
           goto DoneWithDeclSpec;
       }
 
diff --git a/clang/test/CXX/dcl/dcl.spec/dcl.type/dcl.type.general/p2.cpp b/clang/test/CXX/dcl/dcl.spec/dcl.type/dcl.type.general/p2.cpp
new file mode 100644
index 0000000000000..2255cdf11309c
--- /dev/null
+++ b/clang/test/CXX/dcl/dcl.spec/dcl.type/dcl.type.general/p2.cpp
@@ -0,0 +1,11 @@
+// RUN:  %clang_cc1 -std=c++2c -verify %s
+
+void func1() {
+  typedef float foo; // expected-note {{previous definition is here}}
+  auto foo{16};      // expected-error {{redefinition of 'foo' as different kind of symbol}}
+}
+
+typedef float bar;
+void func2() {
+  auto bar{16};
+}

@llvmbot
llvmbot force-pushed the issue210347 branch 2 times, most recently from b726d3e to 065200a Compare July 17, 2026 21:35
@dyung dyung moved this from Needs Triage to Needs Review in LLVM Release Status Jul 18, 2026
@github-project-automation github-project-automation Bot moved this from Needs Review to Needs Merge in LLVM Release Status Jul 20, 2026
…#210347)

The PR llvm#208552 has introduced a regression where brace initialization
was not taken into account `auto foo{12}`. It was also breaking
`dcl.type.general` p2 rules, which is also now tested.

(cherry picked from commit d592aa5)
@dyung
dyung merged commit 9a93aae into llvm:release/23.x Jul 22, 2026
1 check was pending
@github-project-automation github-project-automation Bot moved this from Needs Merge to Done in LLVM Release Status Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category

Projects

Development

Successfully merging this pull request may close these issues.

4 participants