diff options
author | Bill Wendling <isanbard@gmail.com> | 2013-12-23 10:02:34 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2013-12-23 10:02:34 +0000 |
commit | 0e1066e6715006a5c4519893093374076402e047 (patch) | |
tree | 147fd4b7cfe7d780b20132ddf9f842e9efe779c6 /clang/test | |
parent | 04501dbc8b46ee5e7bee424a251d27eba60abba3 (diff) | |
download | llvm-0e1066e6715006a5c4519893093374076402e047.zip llvm-0e1066e6715006a5c4519893093374076402e047.tar.gz llvm-0e1066e6715006a5c4519893093374076402e047.tar.bz2 |
---Merging r196453
Parse: Recover better from bad definitions with base specifiers
We would skip until the next comma, hoping good things whould lie there,
however this would fail when we have such things as this:
struct A {};
template <typename>
struct D;
template <>
struct D<C> : B, A::D;
Once this happens, we would believe that D with a nested namespace
specifier of A was a variable that was being declared. We would go on
to complain that there was an extraneous 'template <>' on their variable
declaration.
Crashes would happen when 'A' gets defined as 'enum class A {}' as
various asserts would fire.
Instead, we should skip up until the semicolon if we see that we are in
the middle of a definition and the current token is a ':'
This fixes PR17084.
llvm-svn: 197905
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/Parser/recovery.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/test/Parser/recovery.cpp b/clang/test/Parser/recovery.cpp index b5b0948..4bed2570 100644 --- a/clang/test/Parser/recovery.cpp +++ b/clang/test/Parser/recovery.cpp @@ -119,3 +119,9 @@ void MissingSemiInFunction() { struct Inner4 {} // ok, no missing ';' here Inner5; } + +namespace PR17084 { +enum class EnumID {}; +template <typename> struct TempID; +template <> struct TempID<BadType> : BadType, EnumID::Garbage; // expected-error{{use of undeclared identifier 'BadType'}} +} |