r188510 - Fix for dependent contexts in alias templates.
Eli Friedman
eli.friedman at gmail.com
Thu Aug 15 16:59:20 PDT 2013
Author: efriedma
Date: Thu Aug 15 18:59:20 2013
New Revision: 188510
URL: http://llvm.org/viewvc/llvm-project?rev=188510&view=rev
Log:
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.
Modified:
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/test/SemaTemplate/alias-templates.cpp
Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=188510&r1=188509&r2=188510&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Thu Aug 15 18:59:20 2013
@@ -2436,7 +2436,7 @@ void Parser::ParseDeclarationSpecifiers(
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(
// 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;
Modified: cfe/trunk/test/SemaTemplate/alias-templates.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/alias-templates.cpp?rev=188510&r1=188509&r2=188510&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/alias-templates.cpp (original)
+++ cfe/trunk/test/SemaTemplate/alias-templates.cpp Thu Aug 15 18:59:20 2013
@@ -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 ';'}}
+}
More information about the cfe-commits
mailing list