[clang] [clang] Reject 'auto' storage class with type specifier in C++ (PR #166004)

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 29 23:35:20 PDT 2026


================
@@ -1704,13 +1704,23 @@ 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}}
+#if __cplusplus >= 201103L
+    // expected-error at -2 {{'auto' cannot be combined with a type specifier}}
----------------
Endilll wrote:

```suggestion
    // since-cxx11-error at -1 {{'auto' cannot be combined with a type specifier}}
```
No need to use `#if __cplusplus` for expected directives.

https://github.com/llvm/llvm-project/pull/166004


More information about the cfe-commits mailing list