diff options
| author | Eli Friedman <eli.friedman@gmail.com> | 2009-06-13 04:51:30 +0000 |
|---|---|---|
| committer | Eli Friedman <eli.friedman@gmail.com> | 2009-06-13 04:51:30 +0000 |
| commit | 9a0e23c495ef4e0ea7ef1b4ba5fa1521735b6ef7 (patch) | |
| tree | 07eb46f940653d53f9318bf691fce78de32239de /clang | |
| parent | 20ee0ed4eaefbf7dba08385137240682e81742e7 (diff) | |
| download | bcm5719-llvm-9a0e23c495ef4e0ea7ef1b4ba5fa1521735b6ef7.tar.gz bcm5719-llvm-9a0e23c495ef4e0ea7ef1b4ba5fa1521735b6ef7.zip | |
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.
llvm-svn: 73285
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiate.cpp | 2 | ||||
| -rw-r--r-- | clang/test/SemaTemplate/instantiate-dependent-nested-name.cpp | 7 | ||||
| -rw-r--r-- | clang/test/SemaTemplate/metafun-apply.cpp | 6 |
3 files changed, 10 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index 1fd11147ed8..4d03e79c656 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -1014,7 +1014,7 @@ Sema::InstantiateNestedNameSpecifier(NestedNameSpecifier *NNS, 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, diff --git a/clang/test/SemaTemplate/instantiate-dependent-nested-name.cpp b/clang/test/SemaTemplate/instantiate-dependent-nested-name.cpp new file mode 100644 index 00000000000..2b1d29878a5 --- /dev/null +++ b/clang/test/SemaTemplate/instantiate-dependent-nested-name.cpp @@ -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; diff --git a/clang/test/SemaTemplate/metafun-apply.cpp b/clang/test/SemaTemplate/metafun-apply.cpp index 7bc971f24b5..9261ed6a6c9 100644 --- a/clang/test/SemaTemplate/metafun-apply.cpp +++ b/clang/test/SemaTemplate/metafun-apply.cpp @@ -23,8 +23,7 @@ struct bogus { 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 @@ void test() { 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}} } |

