mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-11 17:08:42 +00:00
Don't set out-of-line template specialization/definition information
for AST nodes that aren't actually out-of-line (i.e., require a nested-name-specifier). Fixes <rdar://problem/8204126>. llvm-svn: 109704
This commit is contained in:
parent
a44f49f189
commit
43397fc4dc
@ -2617,7 +2617,7 @@ Sema::ActOnVariableDeclarator(Scope* S, Declarator& D, DeclContext* DC,
|
||||
|
||||
SetNestedNameSpecifier(NewVD, D);
|
||||
|
||||
if (NumMatchedTemplateParamLists > 0) {
|
||||
if (NumMatchedTemplateParamLists > 0 && D.getCXXScopeSpec().isSet()) {
|
||||
NewVD->setTemplateParameterListsInfo(Context,
|
||||
NumMatchedTemplateParamLists,
|
||||
(TemplateParameterList**)TemplateParamLists.release());
|
||||
@ -3216,7 +3216,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
|
||||
}
|
||||
}
|
||||
|
||||
if (NumMatchedTemplateParamLists > 0) {
|
||||
if (NumMatchedTemplateParamLists > 0 && D.getCXXScopeSpec().isSet()) {
|
||||
NewFD->setTemplateParameterListsInfo(Context,
|
||||
NumMatchedTemplateParamLists,
|
||||
(TemplateParameterList**)TemplateParamLists.release());
|
||||
|
@ -3819,7 +3819,7 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec,
|
||||
PrevPartial,
|
||||
SequenceNumber);
|
||||
SetNestedNameSpecifier(Partial, SS);
|
||||
if (NumMatchedTemplateParamLists > 0) {
|
||||
if (NumMatchedTemplateParamLists > 0 && SS.isSet()) {
|
||||
Partial->setTemplateParameterListsInfo(Context,
|
||||
NumMatchedTemplateParamLists,
|
||||
(TemplateParameterList**) TemplateParameterLists.release());
|
||||
@ -3877,7 +3877,7 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec,
|
||||
Converted,
|
||||
PrevDecl);
|
||||
SetNestedNameSpecifier(Specialization, SS);
|
||||
if (NumMatchedTemplateParamLists > 0) {
|
||||
if (NumMatchedTemplateParamLists > 0 && SS.isSet()) {
|
||||
Specialization->setTemplateParameterListsInfo(Context,
|
||||
NumMatchedTemplateParamLists,
|
||||
(TemplateParameterList**) TemplateParameterLists.release());
|
||||
|
6
clang/test/SemaTemplate/crash-8204126.cpp
Normal file
6
clang/test/SemaTemplate/crash-8204126.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
||||
struct A
|
||||
{
|
||||
template<int> template<typename T> friend void foo(T) {} // expected-error{{extraneous template parameter list}}
|
||||
void bar() { foo(0); } // expected-error{{use of undeclared identifier 'foo'}}
|
||||
};
|
Loading…
Reference in New Issue
Block a user