mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 388398 - SFINAE for default template arguments
Change-Id: Id4af11365046a57f997de0ee3715cf5ccef9d630 Reviewed-on: https://git.eclipse.org/r/9056 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
ed818d803d
commit
6697364dce
2 changed files with 22 additions and 1 deletions
|
@ -6883,4 +6883,16 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
assertEquals("bool", ASTTypeUtil.getType(td.getType()));
|
||||
ah.assertProblem("B<int*>::type", "type");
|
||||
}
|
||||
|
||||
// struct S {
|
||||
// typedef int a_type;
|
||||
// };
|
||||
// template <typename T, typename = typename T::a_type> int foo(T);
|
||||
// template <typename T, typename = typename T::b_type> void foo(T);
|
||||
// int main() {
|
||||
// foo(S());
|
||||
// }
|
||||
public void testSFINAEInDefaultArgument() throws Exception {
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
|
|||
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
||||
import org.eclipse.cdt.core.dom.ast.IPointerType;
|
||||
import org.eclipse.cdt.core.dom.ast.IQualifierType;
|
||||
import org.eclipse.cdt.core.dom.ast.ISemanticProblem;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||
|
@ -636,7 +637,15 @@ public class TemplateArgumentDeduction {
|
|||
if (deducedArg != null) {
|
||||
deducedArg= CPPTemplates.instantiateArgument(deducedArg, tpMap, -1, null, point);
|
||||
if (deducedArg != null) {
|
||||
tpMap.put(tpar, deducedArg);
|
||||
if (deducedArg instanceof CPPTemplateTypeArgument) {
|
||||
CPPTemplateTypeArgument deducedTypeArg = (CPPTemplateTypeArgument) deducedArg;
|
||||
if (!(deducedTypeArg.getTypeValue() instanceof ISemanticProblem)) {
|
||||
tpMap.put(tpar, deducedArg);
|
||||
}
|
||||
} else {
|
||||
// TODO: Check for problems in non-type or template template parameters?
|
||||
tpMap.put(tpar, deducedArg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue