diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java index 4bdc144e3f5..2332410b4e1 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java @@ -5238,4 +5238,10 @@ public class AST2Tests extends AST2BaseTest { parseAndCheckBindings(getAboveComment(), ParserLanguage.C, true); } + // enum __declspec(uuid("uuid")) bla { a, b}; + public void testDeclspecInEnumSpecifier_bug241203() throws Exception { + for (ParserLanguage lang : ParserLanguage.values()) { + parseAndCheckBindings(getAboveComment(), lang, true); + } + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/AbstractGNUSourceCodeParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/AbstractGNUSourceCodeParser.java index b5347efa5aa..97aaf5fcc7a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/AbstractGNUSourceCodeParser.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/AbstractGNUSourceCodeParser.java @@ -1260,6 +1260,9 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser { final IToken mark= mark(); final int offset= consume().getOffset(); + // if __attribute__ or __declspec occurs after struct/union/class and before the identifier + __attribute_decl_seq(supportAttributeSpecifiers, supportDeclspecSpecifiers); + IASTName name; if (LT(1) == IToken.tIDENTIFIER) { name= createName(identifier()); @@ -2215,21 +2218,10 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser { protected void __declspec() throws BacktrackException, EndOfFileException { IToken token = LA(1); - if (token.getType() == IGCCToken.t__declspec) { consume(); - - token = LA(1); - - if (token.getType() == IToken.tLPAREN) { - consume(); - while(true) { - token = LA(1); - consume(); - if (token.getType() == IToken.tRPAREN) { - break; - } - } + if (LT(1) == IToken.tLPAREN) { + skipBrackets(IToken.tLPAREN, IToken.tRPAREN); } } }