mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 08:55:25 +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
|
@ -125,6 +125,14 @@ public class AST2TemplateTests extends AST2TestBase {
|
|||
private IASTTranslationUnit parseAndCheckBindings(final String code) throws Exception {
|
||||
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 {
|
||||
String code= getAboveComment();
|
||||
|
@ -7130,6 +7138,31 @@ public class AST2TemplateTests extends AST2TestBase {
|
|||
assertNotNull(val);
|
||||
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>
|
||||
// struct M {
|
||||
|
|
|
@ -370,8 +370,8 @@ public class TemplateArgumentDeduction {
|
|||
final ICPPTemplateParameter tpar = tmplParams[i];
|
||||
ICPPTemplateArgument deducedArg= map.getArgument(tpar);
|
||||
if (deducedArg == null) {
|
||||
deducedArg= tpar.getDefaultValue();
|
||||
if (deducedArg == null)
|
||||
deducedArg= CPPTemplates.instantiateArgument(tpar.getDefaultValue(), map, -1, null, point);
|
||||
if (!CPPTemplates.isValidArgument(deducedArg))
|
||||
return null;
|
||||
}
|
||||
result[i]= deducedArg;
|
||||
|
|
Loading…
Add table
Reference in a new issue