[cfe-commits] r93243 - in /cfe/trunk: lib/Parse/ParseDeclCXX.cpp test/SemaTemplate/dependent-base-classes.cpp
Douglas Gregor
dgregor at apple.com
Tue Jan 12 09:52:59 PST 2010
Author: dgregor
Date: Tue Jan 12 11:52:59 2010
New Revision: 93243
URL: http://llvm.org/viewvc/llvm-project?rev=93243&view=rev
Log:
Parse dependent template-ids in base clauses and member
initializers. This isn't actually in the C++ grammar (in any version),
but that's clearly an oversight: both GCC and EDG support this syntax,
and it's used within Boost code. I'll file a core issue proposing
precisely the change made here. Fixes PR6008.
Added:
cfe/trunk/test/SemaTemplate/dependent-base-classes.cpp (with props)
Modified:
cfe/trunk/lib/Parse/ParseDeclCXX.cpp
Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=93243&r1=93242&r2=93243&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Tue Jan 12 11:52:59 2010
@@ -468,7 +468,8 @@
if (Tok.is(tok::annot_template_id)) {
TemplateIdAnnotation *TemplateId
= static_cast<TemplateIdAnnotation *>(Tok.getAnnotationValue());
- if (TemplateId->Kind == TNK_Type_template) {
+ if (TemplateId->Kind == TNK_Type_template ||
+ TemplateId->Kind == TNK_Dependent_template_name) {
AnnotateTemplateIdTokenAsType(SS);
assert(Tok.is(tok::annot_typename) && "template-id -> type failed");
@@ -1527,12 +1528,12 @@
if (Tok.is(tok::annot_template_id)) {
TemplateIdAnnotation *TemplateId
= static_cast<TemplateIdAnnotation *>(Tok.getAnnotationValue());
- if (TemplateId->Kind == TNK_Type_template) {
+ if (TemplateId->Kind == TNK_Type_template ||
+ TemplateId->Kind == TNK_Dependent_template_name) {
AnnotateTemplateIdTokenAsType(&SS);
assert(Tok.is(tok::annot_typename) && "template-id -> type failed");
TemplateTypeTy = Tok.getAnnotationValue();
}
- // FIXME. May need to check for TNK_Dependent_template as well.
}
if (!TemplateTypeTy && Tok.isNot(tok::identifier)) {
Diag(Tok, diag::err_expected_member_or_base_name);
Added: cfe/trunk/test/SemaTemplate/dependent-base-classes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/dependent-base-classes.cpp?rev=93243&view=auto
==============================================================================
--- cfe/trunk/test/SemaTemplate/dependent-base-classes.cpp (added)
+++ cfe/trunk/test/SemaTemplate/dependent-base-classes.cpp Tue Jan 12 11:52:59 2010
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+template<typename T, typename U>
+struct X0 : T::template apply<U> {
+ X0(U u) : T::template apply<U>(u) { }
+};
Propchange: cfe/trunk/test/SemaTemplate/dependent-base-classes.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cfe/trunk/test/SemaTemplate/dependent-base-classes.cpp
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cfe/trunk/test/SemaTemplate/dependent-base-classes.cpp
------------------------------------------------------------------------------
svn:mime-type = text/plain
More information about the cfe-commits
mailing list