Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 923f7534 authored by Eli Friedman's avatar Eli Friedman
Browse files

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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73285 91177308-0d34-0410-b5e6-96231b3b80d8
parent 31a08752
Branches
No related tags found
No related merge requests found
......@@ -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,
......
// 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;
......@@ -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}}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment