mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-30 12:25:35 +02:00
ClassCastException creating type for instance of constructor template, bug 239586.
This commit is contained in:
parent
6848dd5f51
commit
a241c040a7
2 changed files with 14 additions and 2 deletions
|
@ -3093,4 +3093,17 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
ICPPTemplateTypeParameter tp= (ICPPTemplateTypeParameter) spec.getTemplateParameters()[0];
|
ICPPTemplateTypeParameter tp= (ICPPTemplateTypeParameter) spec.getTemplateParameters()[0];
|
||||||
assertNull(tp.getDefault());
|
assertNull(tp.getDefault());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// class X {
|
||||||
|
// template <typename S> X(S s);
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// void test(X a);
|
||||||
|
// void bla(int g) {
|
||||||
|
// test(new X(g));
|
||||||
|
// }
|
||||||
|
public void testBug239586_ClassCast() throws Exception {
|
||||||
|
parseAndCheckBindings(getAboveComment(), ParserLanguage.CPP);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1707,8 +1707,7 @@ public class CPPVisitor {
|
||||||
IBinding binding = name.resolveBinding();
|
IBinding binding = name.resolveBinding();
|
||||||
if (binding instanceof ICPPConstructor) {
|
if (binding instanceof ICPPConstructor) {
|
||||||
try {
|
try {
|
||||||
ICPPClassScope scope = (ICPPClassScope) binding.getScope();
|
type= ((ICPPConstructor) binding).getClassOwner();
|
||||||
type = scope.getClassType();
|
|
||||||
type = new CPPPointerType(type);
|
type = new CPPPointerType(type);
|
||||||
} catch (DOMException e) {
|
} catch (DOMException e) {
|
||||||
type = e.getProblem();
|
type = e.getProblem();
|
||||||
|
|
Loading…
Add table
Reference in a new issue