1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 01:15:29 +02:00

Bug 475894 - Forward declaration of enum at class scope

Change-Id: I51e9bc36350dd403514ce5ec3d48ddb4f456102b
Signed-off-by: Nathan Ridge <zeratul976@hotmail.com>
This commit is contained in:
Nathan Ridge 2015-11-11 02:45:25 -05:00 committed by Sergey Prigogin
parent e5d0038f49
commit 3e81f0437c
3 changed files with 16 additions and 2 deletions

View file

@ -9042,6 +9042,18 @@ public class AST2CPPTests extends AST2TestBase {
String code= getAboveComment();
parseAndCheckBindings(code);
}
// typedef int Int;
// struct S {
// enum waldo1 : int;
// enum waldo2 : Int;
// };
// enum S::waldo1 : int {
// someConstant = 1508
// };
public void testForwardDeclaringEnumAtClassScope_475894() throws Exception {
parseAndCheckBindings();
}
// struct S {
// int m;

View file

@ -35,7 +35,7 @@ public class DeclarationOptions {
GLOBAL= new DeclarationOptions(ALLOW_EMPTY_SPECIFIER | ALLOW_OPAQUE_ENUM | ALLOW_FUNCTION_DEFINITION),
FUNCTION_STYLE_ASM= new DeclarationOptions(ALLOW_EMPTY_SPECIFIER | NO_INITIALIZER | ALLOW_ABSTRACT | ALLOW_FUNCTION_DEFINITION),
C_MEMBER= new DeclarationOptions(ALLOW_BITFIELD | ALLOW_ABSTRACT),
CPP_MEMBER= new DeclarationOptions(ALLOW_EMPTY_SPECIFIER | ALLOW_BITFIELD | NO_CTOR_STYLE_INITIALIZER | ALLOW_FUNCTION_DEFINITION),
CPP_MEMBER= new DeclarationOptions(ALLOW_EMPTY_SPECIFIER | ALLOW_BITFIELD | ALLOW_OPAQUE_ENUM | NO_CTOR_STYLE_INITIALIZER | ALLOW_FUNCTION_DEFINITION),
LOCAL= new DeclarationOptions(ALLOW_OPAQUE_ENUM),
PARAMETER= new DeclarationOptions(ALLOW_ABSTRACT | ALLOW_PARAMETER_PACKS | REQUIRE_SIMPLE_NAME | NO_BRACED_INITIALIZER | NO_CTOR_STYLE_INITIALIZER),
TYPEID= new DeclarationOptions(REQUIRE_ABSTRACT | NO_INITIALIZER),

View file

@ -3447,7 +3447,9 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
attributes = CollectionUtils.merge(attributes, attributeSpecifierSeq());
if (isScoped || LT(1) == IToken.tIDENTIFIER) {
name= identifier();
// A qualified-name can appear here if an enumeration declared at class scope is
// being defined out of line.
name= qualifiedName();
endOffset= calculateEndOffset(name);
}