llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Tony Guillot (to268)
<details>
<summary>Changes</summary>
The PR #<!-- -->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.
---
Full diff: https://github.com/llvm/llvm-project/pull/210347.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 (+13)
``````````diff
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..5b0079a1ba898
--- /dev/null
+++ b/clang/test/CXX/dcl/dcl.spec/dcl.type/dcl.type.general/p2.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -std=c++2c -verify %s
+
+namespace bug {
+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};
+}
+} // namespace bug
``````````
</details>
https://github.com/llvm/llvm-project/pull/210347
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits