diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/SemanticHighlightingTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/SemanticHighlightingTest.java index e986136104a..84eaf335357 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/SemanticHighlightingTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/SemanticHighlightingTest.java @@ -626,4 +626,12 @@ public class SemanticHighlightingTest extends TestCase { public void testVariablePassedByNonconstRef_487764b() throws Exception { makeAssertions(); } + + // void foo(int* const &); //$functionDeclaration + // void bar(int* waldo) { //$functionDeclaration,parameterVariable + // foo(waldo); //$function,parameterVariable + // } + public void testReferenceToConstPointer_509619() throws Exception { + makeAssertions(); + } } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightings.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightings.java index 402325869c1..0142dae25c3 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightings.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightings.java @@ -42,6 +42,7 @@ import org.eclipse.cdt.core.dom.ast.IFunction; import org.eclipse.cdt.core.dom.ast.ILabel; import org.eclipse.cdt.core.dom.ast.IMacroBinding; import org.eclipse.cdt.core.dom.ast.IParameter; +import org.eclipse.cdt.core.dom.ast.IPointerType; import org.eclipse.cdt.core.dom.ast.IProblemBinding; import org.eclipse.cdt.core.dom.ast.IQualifierType; import org.eclipse.cdt.core.dom.ast.IScope; @@ -1711,8 +1712,12 @@ public class SemanticHighlightings { if (referredType instanceof IArrayType) { referredType = ((IArrayType) referredType).getType(); } - boolean isConstRef = (referredType instanceof IQualifierType) && - ((IQualifierType) referredType).isConst(); + boolean isConstRef = false; + if (referredType instanceof IQualifierType) { + isConstRef = ((IQualifierType) referredType).isConst(); + } else if (referredType instanceof IPointerType) { + isConstRef = ((IPointerType) referredType).isConst(); + } return !isConstRef; } return false;