[LLVMbugs] [Bug 9876] New: class in nested namespace with same name suddenly ambigous when compiling with Objective-C++

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon May 9 07:29:08 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=9876

           Summary: class in nested namespace with same name suddenly
                    ambigous when compiling with Objective-C++
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: jonathan.sauer at gmx.de
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


The following code:

namespace A {
    namespace Class {
        class Class { void doIt(); };
    }
}


using namespace A::Class;

void Class::doIt()
{
}


int main(int, char**)
{
}


compiles perfectly using clang in C++ mode. In Objective-C++ mode however, the
following errors are generated:

/opt/bin/clang -x objective-c++ clang.cpp
clang.cpp:10:6: error: expected a class or namespace
void Class::doIt()
     ^
clang.cpp:10:6: error: reference to 'Class' is ambiguous
void Class::doIt()
     ^
note: candidate found by name lookup is 'Class'
clang.cpp:3:9: note: candidate found by name lookup is 'A::Class::Class'
                class Class { void doIt(); };
                      ^
2 errors generated.


It seems as if in Objective-C++ mode, clang is including a "using namespace A"
(to use the using declarations parent namespace), therefore making the "Class"
symbol ambigous.


My clang version:

/opt/bin/clang --version
clang version 3.0 (trunk 131082)
Target: x86_64-apple-darwin10.7.0
Thread model: posix

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list