diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/DOMLocationTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/DOMLocationTests.java index 60a6dcee4e6..3cd7f8ee44a 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/DOMLocationTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/DOMLocationTests.java @@ -440,4 +440,12 @@ public class DOMLocationTests extends AST2BaseTest { assertSoleLocation( endif, code.indexOf( "#endif"), "#endif".length() ); //$NON-NLS-1$ //$NON-NLS-2$ } } + + public void testBug85820() throws Exception { + String code = "int *p = (int []){2, 4};"; //$NON-NLS-1$ + IASTTranslationUnit tu = parse( code, ParserLanguage.C ); + IASTSimpleDeclaration sd = (IASTSimpleDeclaration) tu.getDeclarations()[0]; + IASTDeclarator d = sd.getDeclarators()[0]; + assertSoleLocation( d, code.indexOf("*p = (int []){2, 4}"), "*p = (int []){2, 4}".length() ); //$NON-NLS-1$//$NON-NLS-2$ + } } \ No newline at end of file diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java index 39047e59ff3..1a9c5a23cda 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java @@ -916,7 +916,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser { int lastOffset = consume(IToken.tRPAREN).getEndOffset(); IASTInitializer i = cInitializerClause(Collections.EMPTY_LIST); firstExpression = buildTypeIdInitializerExpression(t, i, - offset, lastOffset); + offset, calculateEndOffset(i)); break; } catch (BacktrackException bt) { backup(m);