summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-02-04 12:22:53 +0000
committerDouglas Gregor <dgregor@apple.com>2011-02-04 12:22:53 +0000
commit4d5c297607e6db63b6f586ddd04477659adb6590 (patch)
treebf762d5088be9b70543a04f54b3dea1daf9962d9 /clang
parent87866ceda70f6ab0664dc7eb3bf7f71fd79cf379 (diff)
downloadbcm5719-llvm-4d5c297607e6db63b6f586ddd04477659adb6590.tar.gz
bcm5719-llvm-4d5c297607e6db63b6f586ddd04477659adb6590.zip
Tweak my fix for PR8748, and update the incorrect PR number in the test case.
llvm-svn: 124863
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp3
-rw-r--r--clang/lib/Sema/SemaTemplate.cpp3
-rw-r--r--clang/test/CXX/temp/temp.param/p9-0x.cpp4
3 files changed, 6 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 88c3a770c27..9db68144666 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -3972,7 +3972,8 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
? TPC_FriendFunctionTemplateDefinition
: TPC_FriendFunctionTemplate)
: (D.getCXXScopeSpec().isSet() &&
- DC && DC->isRecord())
+ DC && DC->isRecord() &&
+ DC->isDependentContext())
? TPC_ClassTemplateMember
: TPC_FunctionTemplate);
}
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index e867354273f..88ba3f9a885 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -947,7 +947,8 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK,
if (CheckTemplateParameterList(TemplateParams,
PrevClassTemplate? PrevClassTemplate->getTemplateParameters() : 0,
(SS.isSet() && SemanticContext &&
- SemanticContext->isRecord())
+ SemanticContext->isRecord() &&
+ SemanticContext->isDependentContext())
? TPC_ClassTemplateMember
: TPC_ClassTemplate))
Invalid = true;
diff --git a/clang/test/CXX/temp/temp.param/p9-0x.cpp b/clang/test/CXX/temp/temp.param/p9-0x.cpp
index c9d5bfb0173..17eca7f7e85 100644
--- a/clang/test/CXX/temp/temp.param/p9-0x.cpp
+++ b/clang/test/CXX/temp/temp.param/p9-0x.cpp
@@ -22,10 +22,10 @@ struct X3 {
}
};
-namespace PR8747 {
+namespace PR8748 {
// Testcase 1
struct A0 { template<typename U> struct B; };
- template<typename U = int> struct A0::B { }; // expected-error{{cannot add a default template argument to the definition of a member of a class template}}
+ template<typename U = int> struct A0::B { };
// Testcase 2
template<typename T> struct A1 { template<typename U> struct B; };
OpenPOWER on IntegriCloud