forked from OSchip/llvm-project
Fix crash on qualified template name instantiation if the template name has no
template argument list. llvm-svn: 330881
This commit is contained in:
parent
c85505450a
commit
0bf96f933a
|
@ -4022,18 +4022,21 @@ ExprResult Sema::BuildTemplateIdExpr(const CXXScopeSpec &SS,
|
|||
assert(!R.empty() && "empty lookup results when building templateid");
|
||||
assert(!R.isAmbiguous() && "ambiguous lookup when building templateid");
|
||||
|
||||
auto AnyDependentArguments = [&]() -> bool {
|
||||
bool InstantiationDependent;
|
||||
return TemplateArgs &&
|
||||
TemplateSpecializationType::anyDependentTemplateArguments(
|
||||
*TemplateArgs, InstantiationDependent);
|
||||
};
|
||||
|
||||
// In C++1y, check variable template ids.
|
||||
bool InstantiationDependent;
|
||||
const bool DependentArguments =
|
||||
TemplateSpecializationType::anyDependentTemplateArguments(
|
||||
*TemplateArgs, InstantiationDependent);
|
||||
if (R.getAsSingle<VarTemplateDecl>() && !DependentArguments) {
|
||||
if (R.getAsSingle<VarTemplateDecl>() && !AnyDependentArguments()) {
|
||||
return CheckVarTemplateId(SS, R.getLookupNameInfo(),
|
||||
R.getAsSingle<VarTemplateDecl>(),
|
||||
TemplateKWLoc, TemplateArgs);
|
||||
}
|
||||
|
||||
if (R.getAsSingle<ConceptDecl>() && !DependentArguments) {
|
||||
if (R.getAsSingle<ConceptDecl>() && !AnyDependentArguments()) {
|
||||
return CheckConceptTemplateId(SS, R.getLookupNameInfo(),
|
||||
R.getAsSingle<ConceptDecl>(),
|
||||
TemplateKWLoc, TemplateArgs);
|
||||
|
|
|
@ -419,3 +419,11 @@ template <typename> struct CT2 {
|
|||
template <class U> struct X;
|
||||
};
|
||||
template <typename T> int CT2<int>::X<>; // expected-error {{template parameter list matching the non-templated nested type 'CT2<int>' should be empty}}
|
||||
|
||||
namespace DependentTemplateIdWithNoArgs {
|
||||
template<typename T> void f() { T::template f(); }
|
||||
struct X {
|
||||
template<int = 0> static void f();
|
||||
};
|
||||
void g() { f<X>(); }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue