Fix for dependent contexts in alias templates.
When we are parsing a type for an alias template, we are not entering the context, so we can't look into dependent classes. Make sure the parser handles this correctly. PR16904. llvm-svn: 188510
This commit is contained in:
parent
89065d8632
commit
2a1d9a9290
|
@ -2436,7 +2436,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
|
|||
|
||||
case tok::coloncolon: // ::foo::bar
|
||||
// C++ scope specifier. Annotate and loop, or bail out on error.
|
||||
if (TryAnnotateCXXScopeToken(true)) {
|
||||
if (TryAnnotateCXXScopeToken(EnteringContext)) {
|
||||
if (!DS.hasTypeSpecifier())
|
||||
DS.SetTypeSpecError();
|
||||
goto DoneWithDeclSpec;
|
||||
|
@ -2632,7 +2632,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
|
|||
// In C++, check to see if this is a scope specifier like foo::bar::, if
|
||||
// so handle it as such. This is important for ctor parsing.
|
||||
if (getLangOpts().CPlusPlus) {
|
||||
if (TryAnnotateCXXScopeToken(true)) {
|
||||
if (TryAnnotateCXXScopeToken(EnteringContext)) {
|
||||
if (!DS.hasTypeSpecifier())
|
||||
DS.SetTypeSpecError();
|
||||
goto DoneWithDeclSpec;
|
||||
|
|
|
@ -189,3 +189,15 @@ namespace PR16646 {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace PR16904 {
|
||||
template <typename,typename>
|
||||
struct base {
|
||||
template <typename> struct derived;
|
||||
};
|
||||
// FIXME: The diagnostics here are terrible.
|
||||
template <typename T, typename U, typename V>
|
||||
using derived = base<T, U>::template derived<V>; // expected-error {{expected a type}} expected-error {{expected ';'}}
|
||||
template <typename T, typename U, typename V>
|
||||
using derived2 = ::PR16904::base<T, U>::template derived<V>; // expected-error {{expected a type}} expected-error {{expected ';'}}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue