[LLVMbugs] [Bug 10450] New: Clang handles ambiguous templates due to 'using' or 'inline namespace' rather horribly

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jul 22 22:12:24 PDT 2011


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

           Summary: Clang handles ambiguous templates due to 'using' or
                    'inline namespace' rather horribly
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: scshunt at csclub.uwaterloo.ca
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Some examples:


scshunt$ clang -x c++ -
namespace A {   
template <typename T> struct foo { };
}
using namespace A;
template <typename T> struct foo { };
foo<int> i;
// EOF

<stdin>:6:1: error: unknown type name 'foo'
foo<int> i;
^
<stdin>:6:4: error: expected unqualified-id                                     
foo<int> i;
   ^
2 errors generated.            



scshunt$ clang -x c++ -
inline namespace A {
template <typename T> struct foo { };
}
template <typename T> struct foo { };
foo<int> i;
// EOF

<stdin>:1:1: warning: inline namespaces are a C++0x feature
[-Wc++0x-extensions]
inline namespace A {
^
1 warning generated.


Remarkably, despite identical semantics, the results are not the same. Both
should be errors due to the ambiguity of 'foo'. The inline namespace case gets
far weirder if template specializations are involved.

-- 
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