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

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 2 10:49:56 PST 2025


================
@@ -399,6 +399,8 @@ def err_requires_clause_on_declarator_not_declaring_a_function : Error<
   "trailing requires clause can only be used when declaring a function">;
 def err_requires_clause_inside_parens : Error<
   "trailing requires clause should be placed outside parentheses">;
+def err_auto_type_specifier : Error<
+  "'auto' cannot be combined with a type specifier in C++">;
----------------
zygoloid wrote:

I would drop the " in C++" here. That's not actually true -- `auto` can be combined with a type specifier in C++98. (And saying " in C++11 onwards" or similar seems unnecessary these days.)

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


More information about the cfe-commits mailing list