mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-20 15:35:24 +02:00
Failing test for bug 433556.
This commit is contained in:
parent
87539d04dd
commit
9ea599ef7b
1 changed files with 169 additions and 156 deletions
|
@ -251,122 +251,6 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
assertTrue("Expected types to be the same, but first was: '" + first.toString() + "' and second was: '" + second + "'", first.isSameType(second));
|
assertTrue("Expected types to be the same, but first was: '" + first.toString() + "' and second was: '" + second + "'", first.isSameType(second));
|
||||||
}
|
}
|
||||||
|
|
||||||
// #define CURLOPTTYPE_OBJECTPOINT 10000
|
|
||||||
// #define CINIT(name,type,number) CURLOPT_ ## name = CURLOPTTYPE_ ## type + number
|
|
||||||
// typedef enum {
|
|
||||||
// CINIT(FILE, OBJECTPOINT, 1),
|
|
||||||
// CINIT(URL, OBJECTPOINT, 2)
|
|
||||||
// } CURLoption ;
|
|
||||||
public void testBug102825() throws Exception {
|
|
||||||
parseAndCheckBindings(getAboveComment());
|
|
||||||
}
|
|
||||||
|
|
||||||
// class B {
|
|
||||||
// public:
|
|
||||||
// B(int t);
|
|
||||||
// };
|
|
||||||
// class A : public B {
|
|
||||||
// public:
|
|
||||||
// A(int t);
|
|
||||||
// };
|
|
||||||
// A::A(int t) : B(t - 1){}
|
|
||||||
public void testBug78883() throws Exception {
|
|
||||||
parseAndCheckBindings(getAboveComment());
|
|
||||||
}
|
|
||||||
|
|
||||||
// enum type {A};
|
|
||||||
// enum type a, b;
|
|
||||||
// type c;
|
|
||||||
// enum type2 {A, B};
|
|
||||||
// enum type2 d, e;
|
|
||||||
public void testBug77967() throws Exception {
|
|
||||||
parseAndCheckBindings(getAboveComment());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testBug75189() throws Exception {
|
|
||||||
parseAndCheckBindings("struct A{};typedef int (*F) (A*);");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testBug75340() throws Exception {
|
|
||||||
IASTTranslationUnit tu = parseAndCheckBindings("void f(int i = 0, int * p = 0);");
|
|
||||||
IASTSimpleDeclaration sd = (IASTSimpleDeclaration) tu.getDeclarations()[0];
|
|
||||||
isParameterSignatureEqual(sd.getDeclarators()[0], "(int=0, int*=0)");
|
|
||||||
}
|
|
||||||
|
|
||||||
// #define REF_WRAP(e) class A { public: A (){ } A& foo2(e& v) { return *this; } }
|
|
||||||
// class B
|
|
||||||
// {
|
|
||||||
// REF_WRAP(B);
|
|
||||||
// B();
|
|
||||||
// void foo();
|
|
||||||
// };
|
|
||||||
public void testBug79540() throws Exception {
|
|
||||||
parseAndCheckBindings(getAboveComment());
|
|
||||||
}
|
|
||||||
|
|
||||||
// template <class T, int someConst=0>
|
|
||||||
// class WithTemplate {};
|
|
||||||
// int main ()
|
|
||||||
// {
|
|
||||||
// WithTemplate <int, 10> normalInstance;
|
|
||||||
// const int localConst=10;
|
|
||||||
// WithTemplate <int, localConst> brokenInstance;
|
|
||||||
// return 0;
|
|
||||||
// }
|
|
||||||
public void testBug103578() throws Exception {
|
|
||||||
parseAndCheckBindings(getAboveComment());
|
|
||||||
}
|
|
||||||
|
|
||||||
// int *p1; int *p2;
|
|
||||||
// union {
|
|
||||||
// struct {int a; int b;} A;
|
|
||||||
// struct {int a; int b;};
|
|
||||||
// } MyStruct;
|
|
||||||
// void test (void) {
|
|
||||||
// p1 = &MyStruct.A.a;
|
|
||||||
// p2 = &MyStruct.b;
|
|
||||||
// MyStruct.b = 1;
|
|
||||||
// }
|
|
||||||
public void testBug78103() throws Exception {
|
|
||||||
parseAndCheckBindings(getAboveComment());
|
|
||||||
}
|
|
||||||
|
|
||||||
// signed int si(0);
|
|
||||||
// unsigned u(10U);
|
|
||||||
// signed s(-1);
|
|
||||||
// short sh(0);
|
|
||||||
// long l(0L);
|
|
||||||
// long long ll(0LL);
|
|
||||||
public void testInitializeUnsigned_245070() throws Exception {
|
|
||||||
parseAndCheckBindings(getAboveComment(), CPP, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// class A {
|
|
||||||
// int m;
|
|
||||||
// };
|
|
||||||
// A* a;
|
|
||||||
// int A::*pm;
|
|
||||||
// int f(){}
|
|
||||||
// int f(int);
|
|
||||||
// int x = f(a->*pm);
|
|
||||||
public void testBug43579() throws Exception {
|
|
||||||
parseAndCheckBindings();
|
|
||||||
}
|
|
||||||
|
|
||||||
// class A { int m(int); };
|
|
||||||
// A a;
|
|
||||||
// int (A::*pm)(int) = &A::m;
|
|
||||||
// int f(){}
|
|
||||||
// int f(int);
|
|
||||||
// int x = f((a.*pm)(5));
|
|
||||||
public void testBug43242() throws Exception {
|
|
||||||
parseAndCheckBindings(getAboveComment());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testBug43241() throws Exception {
|
|
||||||
parseAndCheckBindings("int m(int); int (*pm)(int) = &m; int f(){} int f(int); int x = f((*pm)(5));");
|
|
||||||
}
|
|
||||||
|
|
||||||
// int *zzz1 (char);
|
// int *zzz1 (char);
|
||||||
// int (*zzz2) (char);
|
// int (*zzz2) (char);
|
||||||
// int ((*zzz3)) (char);
|
// int ((*zzz3)) (char);
|
||||||
|
@ -385,11 +269,40 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
assertNoProblemBindings(col);
|
assertNoProblemBindings(col);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBug86282() throws Exception {
|
public void testBug43241() throws Exception {
|
||||||
IASTTranslationUnit tu = parse("void foo() { int (* f[])() = new (int (*[10])()); }", CPP);
|
parseAndCheckBindings("int m(int); int (*pm)(int) = &m; int f(){} int f(int); int x = f((*pm)(5));");
|
||||||
NameCollector col = new NameCollector();
|
}
|
||||||
tu.accept(col);
|
|
||||||
assertNoProblemBindings(col);
|
// class A { int m(int); };
|
||||||
|
// A a;
|
||||||
|
// int (A::*pm)(int) = &A::m;
|
||||||
|
// int f(){}
|
||||||
|
// int f(int);
|
||||||
|
// int x = f((a.*pm)(5));
|
||||||
|
public void testBug43242() throws Exception {
|
||||||
|
parseAndCheckBindings(getAboveComment());
|
||||||
|
}
|
||||||
|
|
||||||
|
// class A {
|
||||||
|
// int m;
|
||||||
|
// };
|
||||||
|
// A* a;
|
||||||
|
// int A::*pm;
|
||||||
|
// int f(){}
|
||||||
|
// int f(int);
|
||||||
|
// int x = f(a->*pm);
|
||||||
|
public void testBug43579() throws Exception {
|
||||||
|
parseAndCheckBindings();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testBug75189() throws Exception {
|
||||||
|
parseAndCheckBindings("struct A{};typedef int (*F) (A*);");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testBug75340() throws Exception {
|
||||||
|
IASTTranslationUnit tu = parseAndCheckBindings("void f(int i = 0, int * p = 0);");
|
||||||
|
IASTSimpleDeclaration sd = (IASTSimpleDeclaration) tu.getDeclarations()[0];
|
||||||
|
isParameterSignatureEqual(sd.getDeclarators()[0], "(int=0, int*=0)");
|
||||||
}
|
}
|
||||||
|
|
||||||
// bool f() {
|
// bool f() {
|
||||||
|
@ -404,32 +317,57 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
assertNoProblemBindings(col);
|
assertNoProblemBindings(col);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBug95424() throws Exception {
|
// enum type {A};
|
||||||
IASTTranslationUnit tu = parse("void f(){ traits_type::copy(__r->_M_refdata(), __buf, __i); }", CPP, true, true);
|
// enum type a, b;
|
||||||
tu = parse("void f(){ traits_type::copy(__r->_M_refdata(), __buf, __i); }", CPP, false, true);
|
// type c;
|
||||||
IASTFunctionDefinition f = (IASTFunctionDefinition) tu.getDeclarations()[0];
|
// enum type2 {A, B};
|
||||||
IASTCompoundStatement cs = (IASTCompoundStatement) f.getBody();
|
// enum type2 d, e;
|
||||||
IASTExpressionStatement es = (IASTExpressionStatement) cs.getStatements()[0];
|
public void testBug77967() throws Exception {
|
||||||
assertTrue(es.getExpression() instanceof IASTFunctionCallExpression);
|
parseAndCheckBindings();
|
||||||
}
|
}
|
||||||
|
|
||||||
// class A { } a;
|
// int *p1; int *p2;
|
||||||
public void testSimpleClass() throws Exception {
|
// union {
|
||||||
IASTTranslationUnit tu = parse(getAboveComment(), CPP);
|
// struct {int a; int b;} A;
|
||||||
IASTSimpleDeclaration decl = (IASTSimpleDeclaration) tu.getDeclarations()[0];
|
// struct {int a; int b;};
|
||||||
IASTCompositeTypeSpecifier compTypeSpec =
|
// } MyStruct;
|
||||||
(IASTCompositeTypeSpecifier) decl.getDeclSpecifier();
|
// void test (void) {
|
||||||
IASTName name_A = compTypeSpec.getName();
|
// p1 = &MyStruct.A.a;
|
||||||
|
// p2 = &MyStruct.b;
|
||||||
|
// MyStruct.b = 1;
|
||||||
|
// }
|
||||||
|
public void testBug78103() throws Exception {
|
||||||
|
parseAndCheckBindings(getAboveComment());
|
||||||
|
}
|
||||||
|
|
||||||
IASTDeclarator dtor = decl.getDeclarators()[0];
|
// class B {
|
||||||
IASTName name_a = dtor.getName();
|
// public:
|
||||||
|
// B(int t);
|
||||||
|
// };
|
||||||
|
// class A : public B {
|
||||||
|
// public:
|
||||||
|
// A(int t);
|
||||||
|
// };
|
||||||
|
// A::A(int t) : B(t - 1) {}
|
||||||
|
public void testBug78883() throws Exception {
|
||||||
|
parseAndCheckBindings();
|
||||||
|
}
|
||||||
|
|
||||||
ICompositeType A = (ICompositeType) name_A.resolveBinding();
|
// #define REF_WRAP(e) class A { public: A (){ } A& foo2(e& v) { return *this; } }
|
||||||
IVariable a = (IVariable) name_a.resolveBinding();
|
// class B {
|
||||||
ICompositeType A_2 = (ICompositeType) a.getType();
|
// REF_WRAP(B);
|
||||||
assertNotNull(A);
|
// B();
|
||||||
assertNotNull(a);
|
// void foo();
|
||||||
assertSame(A, A_2);
|
// };
|
||||||
|
public void testBug79540() throws Exception {
|
||||||
|
parseAndCheckBindings(getAboveComment());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testBug86282() throws Exception {
|
||||||
|
IASTTranslationUnit tu = parse("void foo() { int (* f[])() = new (int (*[10])()); }", CPP);
|
||||||
|
NameCollector col = new NameCollector();
|
||||||
|
tu.accept(col);
|
||||||
|
assertNoProblemBindings(col);
|
||||||
}
|
}
|
||||||
|
|
||||||
// class A {
|
// class A {
|
||||||
|
@ -452,6 +390,71 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
assertNoProblemBindings(nameCol);
|
assertNoProblemBindings(nameCol);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testBug95424() throws Exception {
|
||||||
|
IASTTranslationUnit tu = parse("void f(){ traits_type::copy(__r->_M_refdata(), __buf, __i); }", CPP, true, true);
|
||||||
|
tu = parse("void f(){ traits_type::copy(__r->_M_refdata(), __buf, __i); }", CPP, false, true);
|
||||||
|
IASTFunctionDefinition f = (IASTFunctionDefinition) tu.getDeclarations()[0];
|
||||||
|
IASTCompoundStatement cs = (IASTCompoundStatement) f.getBody();
|
||||||
|
IASTExpressionStatement es = (IASTExpressionStatement) cs.getStatements()[0];
|
||||||
|
assertTrue(es.getExpression() instanceof IASTFunctionCallExpression);
|
||||||
|
}
|
||||||
|
|
||||||
|
// #define CURLOPTTYPE_OBJECTPOINT 10000
|
||||||
|
// #define CINIT(name,type,number) CURLOPT_ ## name = CURLOPTTYPE_ ## type + number
|
||||||
|
// typedef enum {
|
||||||
|
// CINIT(FILE, OBJECTPOINT, 1),
|
||||||
|
// CINIT(URL, OBJECTPOINT, 2)
|
||||||
|
// } CURLoption ;
|
||||||
|
public void testBug102825() throws Exception {
|
||||||
|
parseAndCheckBindings(getAboveComment());
|
||||||
|
}
|
||||||
|
|
||||||
|
// template <class T, int someConst=0>
|
||||||
|
// class WithTemplate {};
|
||||||
|
// int main () {
|
||||||
|
// WithTemplate <int, 10> normalInstance;
|
||||||
|
// const int localConst=10;
|
||||||
|
// WithTemplate <int, localConst> brokenInstance;
|
||||||
|
// return 0;
|
||||||
|
// }
|
||||||
|
public void testBug103578() throws Exception {
|
||||||
|
parseAndCheckBindings(getAboveComment());
|
||||||
|
}
|
||||||
|
|
||||||
|
// template <typename T>
|
||||||
|
// struct A {
|
||||||
|
// template <typename U> class B;
|
||||||
|
// typedef int type;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// template <typename T>
|
||||||
|
// template <typename U>
|
||||||
|
// struct A<T>::B {
|
||||||
|
// typedef typename A::type type;
|
||||||
|
// };
|
||||||
|
public void _testBug433556() throws Exception {
|
||||||
|
parseAndCheckBindings();
|
||||||
|
}
|
||||||
|
|
||||||
|
// class A { } a;
|
||||||
|
public void testSimpleClass() throws Exception {
|
||||||
|
IASTTranslationUnit tu = parse(getAboveComment(), CPP);
|
||||||
|
IASTSimpleDeclaration decl = (IASTSimpleDeclaration) tu.getDeclarations()[0];
|
||||||
|
IASTCompositeTypeSpecifier compTypeSpec =
|
||||||
|
(IASTCompositeTypeSpecifier) decl.getDeclSpecifier();
|
||||||
|
IASTName name_A = compTypeSpec.getName();
|
||||||
|
|
||||||
|
IASTDeclarator dtor = decl.getDeclarators()[0];
|
||||||
|
IASTName name_a = dtor.getName();
|
||||||
|
|
||||||
|
ICompositeType A = (ICompositeType) name_A.resolveBinding();
|
||||||
|
IVariable a = (IVariable) name_a.resolveBinding();
|
||||||
|
ICompositeType A_2 = (ICompositeType) a.getType();
|
||||||
|
assertNotNull(A);
|
||||||
|
assertNotNull(a);
|
||||||
|
assertSame(A, A_2);
|
||||||
|
}
|
||||||
|
|
||||||
// class A; class A {};
|
// class A; class A {};
|
||||||
public void testClassForwardDecl() throws Exception {
|
public void testClassForwardDecl() throws Exception {
|
||||||
IASTTranslationUnit tu = parse(getAboveComment(), CPP);
|
IASTTranslationUnit tu = parse(getAboveComment(), CPP);
|
||||||
|
@ -5462,18 +5465,6 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
parse(getAboveComment(), CPP, true, true);
|
parse(getAboveComment(), CPP, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// namespace outer {
|
|
||||||
// namespace inner {
|
|
||||||
// class foo{};
|
|
||||||
// }
|
|
||||||
// using namespace inner __attribute__((__strong__));
|
|
||||||
// }
|
|
||||||
// outer::foo x;
|
|
||||||
// outer::inner::foo y;
|
|
||||||
public void testAttributeInUsingDirective_351228() throws Exception {
|
|
||||||
parseAndCheckBindings(getAboveComment(), CPP, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// class C {
|
// class C {
|
||||||
// public:
|
// public:
|
||||||
// int i;
|
// int i;
|
||||||
|
@ -5525,6 +5516,18 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
assertInstance(b09, ICPPFunction.class);
|
assertInstance(b09, ICPPFunction.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// namespace outer {
|
||||||
|
// namespace inner {
|
||||||
|
// class foo{};
|
||||||
|
// }
|
||||||
|
// using namespace inner __attribute__((__strong__));
|
||||||
|
// }
|
||||||
|
// outer::foo x;
|
||||||
|
// outer::inner::foo y;
|
||||||
|
public void testAttributeInUsingDirective_351228() throws Exception {
|
||||||
|
parseAndCheckBindings(getAboveComment(), CPP, true);
|
||||||
|
}
|
||||||
|
|
||||||
// namespace source {
|
// namespace source {
|
||||||
// class cls {
|
// class cls {
|
||||||
// };
|
// };
|
||||||
|
@ -5824,6 +5827,16 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
assertTrue(type.isLong());
|
assertTrue(type.isLong());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// signed int si(0);
|
||||||
|
// unsigned u(10U);
|
||||||
|
// signed s(-1);
|
||||||
|
// short sh(0);
|
||||||
|
// long l(0L);
|
||||||
|
// long long ll(0LL);
|
||||||
|
public void testInitializeUnsigned_245070() throws Exception {
|
||||||
|
parseAndCheckBindings(getAboveComment(), CPP, true);
|
||||||
|
}
|
||||||
|
|
||||||
// void foo/*_a*/(int x) {}
|
// void foo/*_a*/(int x) {}
|
||||||
// void foo/*_b*/(unsigned int) {}
|
// void foo/*_b*/(unsigned int) {}
|
||||||
// void foo/*_c*/(short x) {}
|
// void foo/*_c*/(short x) {}
|
||||||
|
|
Loading…
Add table
Reference in a new issue