[clang] Fix auto with type in modern C++ (PR #208552)
Vlad Serebrennikov via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 9 23:57:06 PDT 2026
================
@@ -1704,14 +1704,16 @@ namespace cwg395 { // cwg395: 3.0
namespace cwg396 { // cwg396: 3.0
void f() {
- auto int a();
- // since-cxx11-error at -1 {{'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases}}
- // expected-error at -2 {{illegal storage class on function}}
+ auto int a(); // #cwg396-a
+ // cxx98-error@#cwg396-a {{illegal storage class on function}}
+ // since-cxx11-error@#cwg396-a {{'auto' cannot be combined with a type specifier}}
+ // since-cxx11-warning@#cwg396-a {{empty parentheses interpreted as a function declaration}}
+ // since-cxx11-note@#cwg396-a {{replace parentheses with an initializer to declare a variable}}
int (i); // #cwg396-i
- auto int (i);
- // since-cxx11-error at -1 {{'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases}}
- // expected-error at -2 {{redefinition of 'i'}}
- // expected-note@#cwg396-i {{previous definition is here}}
+ auto int (i); // #cwg396-auto-i
+ // cxx98-error@#cwg396-auto-i {{redefinition of 'i'}}
+ // cxx98-note@#cwg396-i {{previous definition is here}}
----------------
Endilll wrote:
```suggestion
// cxx98-note@#cwg396-i {{previous definition is here}}
```
https://github.com/llvm/llvm-project/pull/208552
More information about the cfe-commits
mailing list