From f208496afe26cb07ef46b4625620a5dc47ccbeca Mon Sep 17 00:00:00 2001 From: Markus Schorn Date: Wed, 20 Oct 2010 14:29:46 +0000 Subject: [PATCH] Bug 328063: Typedef to cv-qualified class as class-name. --- .../cdt/core/parser/tests/ast2/AST2CPPTests.java | 10 +++++++++- .../core/dom/parser/cpp/semantics/CPPVisitor.java | 12 +++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java index 7690a4352a0..ba65e331557 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java @@ -9245,5 +9245,13 @@ public class AST2CPPTests extends AST2BaseTest { ref= bh.assertNonProblem("f(&number)", 1); assertSame(f2, ref); } - + + // struct S { + // class C {}; + // }; + // typedef const S T; + // T::C c; + public void testCVQualifiedClassName_328063() throws Exception { + parseAndCheckBindings(); + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java index 2cc76611529..36bfe23719f 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java @@ -1048,11 +1048,13 @@ public class CPPVisitor extends ASTQueries { // For template functions we may need to resolve a template parameter // as a parent of an unknown type used as parameter type. IBinding binding = names[i - 1].resolvePreBinding(); - while (binding instanceof ITypedef) { - IType t = ((ITypedef) binding).getType(); - if (t instanceof IBinding) - binding = (IBinding) t; - else break; + + // 7.1.3-7 Unwrap typedefs, delete cv-qualifiers. + if (binding instanceof ITypedef) { + IType type= getNestedType((ITypedef) binding, TDEF | CVTYPE); + if (type instanceof IBinding) { + binding= (IBinding) type; + } } boolean done= true; IScope scope= null;