1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 08:55:25 +02:00

ClassCastException creating type for instance of constructor template, bug 239586.

This commit is contained in:
Markus Schorn 2008-07-08 12:38:45 +00:00
parent 6848dd5f51
commit a241c040a7
2 changed files with 14 additions and 2 deletions

View file

@ -3093,4 +3093,17 @@ public class AST2TemplateTests extends AST2BaseTest {
ICPPTemplateTypeParameter tp= (ICPPTemplateTypeParameter) spec.getTemplateParameters()[0];
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);
}
}

View file

@ -1707,8 +1707,7 @@ public class CPPVisitor {
IBinding binding = name.resolveBinding();
if (binding instanceof ICPPConstructor) {
try {
ICPPClassScope scope = (ICPPClassScope) binding.getScope();
type = scope.getClassType();
type= ((ICPPConstructor) binding).getClassOwner();
type = new CPPPointerType(type);
} catch (DOMException e) {
type = e.getProblem();