From 2820e4b9fb6719c10b0dc0e8fef1568a231adf28 Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Wed, 23 Jan 2013 09:26:08 -0800 Subject: [PATCH] Bug 394151 - Regression: ClassCastException evaluating read/write flags --- .../index/tests/IndexCBindingResolutionBugs.java | 15 ++++++++++++++- .../core/dom/parser/VariableReadWriteFlags.java | 5 +++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCBindingResolutionBugs.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCBindingResolutionBugs.java index 1f4f785bdde..ea7a3a80dd6 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCBindingResolutionBugs.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCBindingResolutionBugs.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2010 Wind River Systems, Inc. and others. + * Copyright (c) 2006, 2013 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,6 +8,7 @@ * Contributors: * Markus Schorn - initial API and implementation * Andrew Ferguson (Symbian) + * Sergey Prigogin (Google) *******************************************************************************/ package org.eclipse.cdt.internal.index.tests; @@ -475,4 +476,16 @@ public class IndexCBindingResolutionBugs extends IndexBindingResolutionTestBase public void testDesignatedInitializer_Bug210019() throws Exception { IField f= getBindingFromASTName("f", 0); } + + // struct S { + // int data; + // }; + + // void test(void (*f)(void*)) { + // struct S *i; + // f(&i->data); + // } + public void testBug394151() throws Exception { + IParameter f= getBindingFromASTName("f(", 1); + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/VariableReadWriteFlags.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/VariableReadWriteFlags.java index a800794bc05..b32d1f97e6a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/VariableReadWriteFlags.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/VariableReadWriteFlags.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2011 Wind River Systems, Inc. and others. + * Copyright (c) 2007, 2013 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,6 +7,7 @@ * * Contributors: * Markus Schorn - initial API and implementation + * Sergey Prigogin (Google) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser; @@ -191,7 +192,7 @@ public abstract class VariableReadWriteFlags { final IType type= functionNameExpression.getExpressionType(); if (type instanceof IFunctionType) { return rwArgumentForFunctionCall((IFunctionType) type, i, indirection); - } else { + } else if (funcCall instanceof IASTImplicitNameOwner) { IASTImplicitName[] implicitNames = ((IASTImplicitNameOwner) funcCall).getImplicitNames(); if (implicitNames.length == 1) { IASTImplicitName name = implicitNames[0];