diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-03-07 23:26:22 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-03-07 23:26:22 +0000 |
commit | 281c486e1bf02b9354a3781d861cebfbf877a75e (patch) | |
tree | 3496c918af923809ebd22717c627ca1b41b75090 | |
parent | c934bc840cb483a56da06bd9dbeff8bab32af84d (diff) | |
download | llvm-281c486e1bf02b9354a3781d861cebfbf877a75e.zip llvm-281c486e1bf02b9354a3781d861cebfbf877a75e.tar.gz llvm-281c486e1bf02b9354a3781d861cebfbf877a75e.tar.bz2 |
Robustify callers that rebuild typename type nodes again NULL return
types. Fixes PR6463.
llvm-svn: 97924
-rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 3 | ||||
-rw-r--r-- | clang/lib/Sema/SemaTemplate.cpp | 3 | ||||
-rw-r--r-- | clang/test/SemaTemplate/typename-specifier-4.cpp | 17 |
3 files changed, 23 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index b959202..e32d14e 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -1083,6 +1083,9 @@ Sema::ActOnMemInitializer(DeclPtrTy ConstructorD, // specialization, we take it as a type name. BaseType = CheckTypenameType((NestedNameSpecifier *)SS.getScopeRep(), *MemberOrBase, SS.getRange()); + if (BaseType.isNull()) + return true; + R.clear(); } } diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 0321958..445b68b 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -4992,6 +4992,9 @@ CurrentInstantiationRebuilder::TransformTypenameType(TypeLocBuilder &TLB, Result = getDerived().RebuildTypenameType(NNS, T->getIdentifier(), SourceRange(TL.getNameLoc())); + if (Result.isNull()) + return QualType(); + TypenameTypeLoc NewTL = TLB.push<TypenameTypeLoc>(Result); NewTL.setNameLoc(TL.getNameLoc()); return Result; diff --git a/clang/test/SemaTemplate/typename-specifier-4.cpp b/clang/test/SemaTemplate/typename-specifier-4.cpp index 0a6fef7..280a1b4 100644 --- a/clang/test/SemaTemplate/typename-specifier-4.cpp +++ b/clang/test/SemaTemplate/typename-specifier-4.cpp @@ -99,3 +99,20 @@ namespace PR6268 { return Inner<U>(); } } + +namespace PR6463 { + struct B { typedef int type; }; // expected-note 2{{member found by ambiguous name lookup}} + struct C { typedef int type; }; // expected-note 2{{member found by ambiguous name lookup}} + + template<typename T> + struct A : B, C { + type& a(); // expected-error{{found in multiple base classes}} + int x; + }; + + // FIXME: Improve source location info here. + template<typename T> + typename A<T>::type& A<T>::a() { // expected-error{{found in multiple base classes}} + return x; // expected-error{{undeclared identifier}} + } +} |