mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Syntax error with constructor initializer, bug 245070.
This commit is contained in:
parent
f39d829c21
commit
8e72b07f59
2 changed files with 24 additions and 4 deletions
|
@ -215,6 +215,16 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
parseAndCheckBindings( getAboveComment() );
|
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_Bug245070() throws Exception {
|
||||||
|
parseAndCheckBindings(getAboveComment(), ParserLanguage.CPP, true);
|
||||||
|
}
|
||||||
|
|
||||||
public void testBug43579() throws Exception {
|
public void testBug43579() throws Exception {
|
||||||
parseAndCheckBindings("class A { int m; }; \n A * a; int A::*pm; \n int f(){} \n int f(int); \n int x = f(a->*pm);"); //$NON-NLS-1$
|
parseAndCheckBindings("class A { int m; }; \n A * a; int A::*pm; \n int f(){} \n int f(int); \n int x = f(a->*pm);"); //$NON-NLS-1$
|
||||||
parseAndCheckBindings("class A { int m; }; \n A * a; int A::*pm; \n int f(){} \n int f(int); \n int x = f(a->*pm);"); //$NON-NLS-1$
|
parseAndCheckBindings("class A { int m; }; \n A * a; int A::*pm; \n int f(){} \n int f(int); \n int x = f(a->*pm);"); //$NON-NLS-1$
|
||||||
|
|
|
@ -3110,16 +3110,26 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
|
|
||||||
private boolean canHaveConstructorInitializer(IASTDeclSpecifier declspec) {
|
private boolean canHaveConstructorInitializer(IASTDeclSpecifier declspec) {
|
||||||
if (declspec instanceof ICPPASTSimpleDeclSpecifier) {
|
if (declspec instanceof ICPPASTSimpleDeclSpecifier) {
|
||||||
ICPPASTSimpleDeclSpecifier simpleSpecifier= (ICPPASTSimpleDeclSpecifier) declspec;
|
ICPPASTSimpleDeclSpecifier sspec= (ICPPASTSimpleDeclSpecifier) declspec;
|
||||||
switch(simpleSpecifier.getType()) {
|
switch(sspec.getType()) {
|
||||||
case IASTSimpleDeclSpecifier.t_unspecified:
|
case IASTSimpleDeclSpecifier.t_unspecified:
|
||||||
|
if (sspec.isLong() || sspec.isShort() || sspec.isSigned() || sspec.isUnsigned())
|
||||||
|
return true;
|
||||||
|
if (sspec instanceof IGPPASTSimpleDeclSpecifier) {
|
||||||
|
final IGPPASTSimpleDeclSpecifier gspec = (IGPPASTSimpleDeclSpecifier) sspec;
|
||||||
|
if (gspec.isLongLong())
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
case IASTSimpleDeclSpecifier.t_void:
|
case IASTSimpleDeclSpecifier.t_void:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (simpleSpecifier.isFriend()) {
|
|
||||||
|
if (sspec.isFriend()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (simpleSpecifier.getStorageClass() == IASTDeclSpecifier.sc_typedef) {
|
if (sspec.getStorageClass() == IASTDeclSpecifier.sc_typedef) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue