mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-01 21:35:40 +02:00
Bug 409056 - Invalid ambiguity with templated conversion operator
Change-Id: I9f56c875899ee2543aab2090387dbbdfd0e489b4 Reviewed-on: https://git.eclipse.org/r/13151 Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com> IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com> Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
This commit is contained in:
parent
dc086d6a53
commit
255cd71f24
2 changed files with 35 additions and 2 deletions
|
@ -126,6 +126,14 @@ public class AST2TemplateTests extends AST2TestBase {
|
||||||
return parseAndCheckBindings(code, CPP);
|
return parseAndCheckBindings(code, CPP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected IASTTranslationUnit parseAndCheckImplicitNameBindings() throws Exception {
|
||||||
|
IASTTranslationUnit tu = parse(getAboveComment(), CPP, false, true, false);
|
||||||
|
NameCollector col = new NameCollector(true /* visit implicit names */);
|
||||||
|
tu.accept(col);
|
||||||
|
assertNoProblemBindings(col);
|
||||||
|
return tu;
|
||||||
|
}
|
||||||
|
|
||||||
protected BindingAssertionHelper getAssertionHelper() throws ParserException, IOException {
|
protected BindingAssertionHelper getAssertionHelper() throws ParserException, IOException {
|
||||||
String code= getAboveComment();
|
String code= getAboveComment();
|
||||||
return new BindingAssertionHelper(code, true);
|
return new BindingAssertionHelper(code, true);
|
||||||
|
@ -7131,6 +7139,31 @@ public class AST2TemplateTests extends AST2TestBase {
|
||||||
assertEquals(0 /* false */, val.longValue());
|
assertEquals(0 /* false */, val.longValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// struct S {
|
||||||
|
// S(int);
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// template <typename>
|
||||||
|
// struct meta {};
|
||||||
|
//
|
||||||
|
// template <>
|
||||||
|
// struct meta<S> {
|
||||||
|
// typedef void type;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// struct B {
|
||||||
|
// template <typename T, typename = typename meta<T>::type>
|
||||||
|
// operator T() const;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// struct A {
|
||||||
|
// S waldo;
|
||||||
|
// A() : waldo(B{}) {}
|
||||||
|
// };
|
||||||
|
public void testSFINAEInTemplatedConversionOperator_409056() throws Exception {
|
||||||
|
parseAndCheckImplicitNameBindings();
|
||||||
|
}
|
||||||
|
|
||||||
// template <typename>
|
// template <typename>
|
||||||
// struct M {
|
// struct M {
|
||||||
// template <typename... Args>
|
// template <typename... Args>
|
||||||
|
|
|
@ -370,8 +370,8 @@ public class TemplateArgumentDeduction {
|
||||||
final ICPPTemplateParameter tpar = tmplParams[i];
|
final ICPPTemplateParameter tpar = tmplParams[i];
|
||||||
ICPPTemplateArgument deducedArg= map.getArgument(tpar);
|
ICPPTemplateArgument deducedArg= map.getArgument(tpar);
|
||||||
if (deducedArg == null) {
|
if (deducedArg == null) {
|
||||||
deducedArg= tpar.getDefaultValue();
|
deducedArg= CPPTemplates.instantiateArgument(tpar.getDefaultValue(), map, -1, null, point);
|
||||||
if (deducedArg == null)
|
if (!CPPTemplates.isValidArgument(deducedArg))
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
result[i]= deducedArg;
|
result[i]= deducedArg;
|
||||||
|
|
Loading…
Add table
Reference in a new issue