[cfe-commits] r73285 - in /cfe/trunk: lib/Sema/SemaTemplateInstantiate.cpp test/SemaTemplate/instantiate-dependent-nested-name.cpp test/SemaTemplate/metafun-apply.cpp
Eli Friedman
eli.friedman at gmail.com
Fri Jun 12 21:51:30 PDT 2009
Author: efriedma
Date: Fri Jun 12 23:51:30 2009
New Revision: 73285
URL: http://llvm.org/viewvc/llvm-project?rev=73285&view=rev
Log:
Fix for PR4382: allow instantiating dependent nested name specifiers.
I'm not completely sure this is the right way to fix this issue, but it seems
reasonable, and it's consistent with the non-template code for this
construct.
Added:
cfe/trunk/test/SemaTemplate/instantiate-dependent-nested-name.cpp
Modified:
cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
cfe/trunk/test/SemaTemplate/metafun-apply.cpp
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=73285&r1=73284&r2=73285&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Fri Jun 12 23:51:30 2009
@@ -1014,7 +1014,7 @@
if (T.isNull())
return 0;
- if (T->isRecordType() ||
+ if (T->isDependentType() || T->isRecordType() ||
(getLangOptions().CPlusPlus0x && T->isEnumeralType())) {
assert(T.getCVRQualifiers() == 0 && "Can't get cv-qualifiers here");
return NestedNameSpecifier::Create(Context, Prefix,
Added: cfe/trunk/test/SemaTemplate/instantiate-dependent-nested-name.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/instantiate-dependent-nested-name.cpp?rev=73285&view=auto
==============================================================================
--- cfe/trunk/test/SemaTemplate/instantiate-dependent-nested-name.cpp (added)
+++ cfe/trunk/test/SemaTemplate/instantiate-dependent-nested-name.cpp Fri Jun 12 23:51:30 2009
@@ -0,0 +1,7 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+// PR4382
+template<typename T> struct X { static const T A = 1; };
+template<typename T, bool = X<T>::A> struct Y { typedef T A; };
+template<typename T> struct Z { typedef typename Y<T>::A A; };
+extern int x;
+extern Z<int>::A x;
Modified: cfe/trunk/test/SemaTemplate/metafun-apply.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/metafun-apply.cpp?rev=73285&r1=73284&r2=73285&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/metafun-apply.cpp (original)
+++ cfe/trunk/test/SemaTemplate/metafun-apply.cpp Fri Jun 12 23:51:30 2009
@@ -23,8 +23,7 @@
template<typename MetaFun, typename T>
struct apply1 {
typedef typename MetaFun::template apply<T>::type type; // expected-note{{in instantiation of template class 'struct add_reference::apply<void>' requested here}} \
- // expected-error{{'apply' following the 'template' keyword does not refer to a template}} \
- // FIXME: expected-error{{type 'MetaFun::template apply<int>' cannot be used prior to '::' because it has no members}}
+ // expected-error{{'apply' following the 'template' keyword does not refer to a template}}
};
int i;
@@ -36,8 +35,7 @@
apply1<add_reference, void>::type t; // expected-note{{in instantiation of template class 'struct apply1<struct add_reference, void>' requested here}} \
// FIXME: expected-error{{unexpected type name 'type': expected expression}}
- apply1<bogus, int>::type t2; // expected-note{{in instantiation of template class 'struct apply1<struct bogus, int>' requested here}} \
- // FIXME: expected-error{{unexpected type name 'type': expected expression}}
+ apply1<bogus, int>::type t2; // expected-note{{in instantiation of template class 'struct apply1<struct bogus, int>' requested here}}
}
More information about the cfe-commits
mailing list