================
@@ -1,8 +1,16 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++98 -Wc++11-compat
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++98 -Wc++11-compat
void f() {
auto int a; // expected-warning {{'auto' storage class specifier is
redundant and incompatible with C++11}}
int auto b; // expected-warning {{'auto' storage class specifier is
redundant and incompatible with C++11}}
auto c; // expected-warning {{C++11 extension}} expected-error {{requires an
initializer}}
static auto d = 0; // expected-warning {{C++11 extension}}
auto static e = 0; // expected-warning {{C++11 extension}}
}
+
+// typedef and auto storage-class-specifier cannot appear in the same
+// decl-specifier-seq ([dcl.stc] p1). This must be diagnosed in C++98 even
+// though 'auto int' (without typedef) is valid there.
+void g() {
+ typedef auto int t1; // expected-error {{cannot combine with previous
'typedef' declaration specifier}}
----------------
AaronBallman wrote:
> We just emit the diagnostic at a different/earlier point but it is still an
> equivalent diagnostic which correctly points out the problem:
Ah, I think this was my mistake coupled with the diagnostic wording being a bit
more ambiguous unless you see the caret. The new behavior is saying cannot
combine with the previous `typedef` specifier, it previously was saying `auto`
specifier.
I think `auto not allowed in typedef` was more clear, but this is definitely
equivalent when I was thinking it wasn't, sorry about that!
https://github.com/llvm/llvm-project/pull/210141
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits