aboutsummaryrefslogtreecommitdiff
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
commit461bf2eb82981d00a014409126ef9c3538551a94 (patch)
tree285805622dc2780c58155a450f930430349c702c
parentdef0354384d9c4431f7b58b664b59896d4623028 (diff)
Tweak my fix for PR8748, and update the incorrect PR number in the test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124863 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaDecl.cpp3
-rw-r--r--lib/Sema/SemaTemplate.cpp3
-rw-r--r--test/CXX/temp/temp.param/p9-0x.cpp4
3 files changed, 6 insertions, 4 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 88c3a770c2..9db6814466 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/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/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp
index e867354273..88ba3f9a88 100644
--- a/lib/Sema/SemaTemplate.cpp
+++ b/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/test/CXX/temp/temp.param/p9-0x.cpp b/test/CXX/temp/temp.param/p9-0x.cpp
index c9d5bfb017..17eca7f7e8 100644
--- a/test/CXX/temp/temp.param/p9-0x.cpp
+++ b/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; };