forked from OSchip/llvm-project
Handle dependent class template names in class template argument
deduction for new-expressions. llvm-svn: 343293
This commit is contained in:
parent
2fc9c3b05f
commit
cff420120f
|
@ -9155,8 +9155,11 @@ QualType Sema::DeduceTemplateSpecializationFromInitializer(
|
||||||
TSInfo->getType()->getContainedDeducedType());
|
TSInfo->getType()->getContainedDeducedType());
|
||||||
assert(DeducedTST && "not a deduced template specialization type");
|
assert(DeducedTST && "not a deduced template specialization type");
|
||||||
|
|
||||||
// We can only perform deduction for class templates.
|
|
||||||
auto TemplateName = DeducedTST->getTemplateName();
|
auto TemplateName = DeducedTST->getTemplateName();
|
||||||
|
if (TemplateName.isDependent())
|
||||||
|
return Context.DependentTy;
|
||||||
|
|
||||||
|
// We can only perform deduction for class templates.
|
||||||
auto *Template =
|
auto *Template =
|
||||||
dyn_cast_or_null<ClassTemplateDecl>(TemplateName.getAsTemplateDecl());
|
dyn_cast_or_null<ClassTemplateDecl>(TemplateName.getAsTemplateDecl());
|
||||||
if (!Template) {
|
if (!Template) {
|
||||||
|
|
|
@ -307,6 +307,13 @@ namespace dependent {
|
||||||
template int Var(int);
|
template int Var(int);
|
||||||
template int Cast(int);
|
template int Cast(int);
|
||||||
template int New(int);
|
template int New(int);
|
||||||
|
|
||||||
|
template<template<typename> typename Y> void test() {
|
||||||
|
Y(0);
|
||||||
|
new Y(0);
|
||||||
|
Y y(0);
|
||||||
|
}
|
||||||
|
template void test<X>();
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace injected_class_name {
|
namespace injected_class_name {
|
||||||
|
|
Loading…
Reference in New Issue