mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-10 17:55:39 +02:00
Bug 519361: use placeholder type for template<auto>
Change-Id: I40f96479148a92618050ba50d7761f478f92024d Signed-off-by: Vlad Ivanov <vlad@ivanov.email>
This commit is contained in:
parent
9cf1f0625e
commit
0bf58281c2
3 changed files with 24 additions and 7 deletions
|
@ -33,4 +33,18 @@ public class TemplateAutoTests extends AST2CPPTestBase {
|
||||||
public void testTemplateNontypeParameterTypeDeductionParsing_519361() throws Exception {
|
public void testTemplateNontypeParameterTypeDeductionParsing_519361() throws Exception {
|
||||||
parseAndCheckBindings();
|
parseAndCheckBindings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// template<typename T>
|
||||||
|
// struct Helper {};
|
||||||
|
//
|
||||||
|
// void test() {}
|
||||||
|
//
|
||||||
|
// template<auto F>
|
||||||
|
// struct C {
|
||||||
|
// using T = decltype(F);
|
||||||
|
// using H = Helper<T>;
|
||||||
|
// };
|
||||||
|
public void testTemplateNontypeParameterTypeDeductionParsing_519361_2() throws Exception {
|
||||||
|
parseAndCheckBindings();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,6 +164,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPMethodSpecialization;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPMethodTemplateSpecialization;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPMethodTemplateSpecialization;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPParameterPackType;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPParameterPackType;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPParameterSpecialization;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPParameterSpecialization;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPPlaceholderType;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPPointerToMemberType;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPPointerToMemberType;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPPointerType;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPPointerType;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateDefinition;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateDefinition;
|
||||||
|
@ -2866,11 +2867,9 @@ public class CPPTemplates {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (paramType instanceof ProblemType) {
|
if (paramType instanceof CPPPlaceholderType) {
|
||||||
// Partial support for C++17 template <auto>
|
// Partial support for C++17 template <auto>
|
||||||
if (((ProblemType) paramType).getID() == ProblemType.TYPE_CANNOT_DEDUCE_AUTO_TYPE) {
|
return arg;
|
||||||
return arg;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Cost cost = Conversions.checkImplicitConversionSequence(p, a, LVALUE, UDCMode.FORBIDDEN,
|
Cost cost = Conversions.checkImplicitConversionSequence(p, a, LVALUE, UDCMode.FORBIDDEN,
|
||||||
|
|
|
@ -2214,9 +2214,13 @@ public class CPPVisitor extends ASTQueries {
|
||||||
return createAutoParameterType(declSpec, declarator,
|
return createAutoParameterType(declSpec, declarator,
|
||||||
(ICPPASTParameterDeclaration) declarator.getParent(), placeholderKind);
|
(ICPPASTParameterDeclaration) declarator.getParent(), placeholderKind);
|
||||||
} else {
|
} else {
|
||||||
// 'auto' used as the type of a template parameter.
|
if (placeholderKind == PlaceholderKind.Auto) {
|
||||||
// This is a C++17 feature we don't yet support.
|
// 'auto' used as the type of a template parameter.
|
||||||
return ProblemType.CANNOT_DEDUCE_AUTO_TYPE;
|
// This is a partially supported C++17 feature.
|
||||||
|
return new CPPPlaceholderType(placeholderKind);
|
||||||
|
} else {
|
||||||
|
return ProblemType.CANNOT_DEDUCE_DECLTYPE_AUTO_TYPE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ICPPASTInitializerClause autoInitClause= null;
|
ICPPASTInitializerClause autoInitClause= null;
|
||||||
|
|
Loading…
Add table
Reference in a new issue