https://bugs.llvm.org/show_bug.cgi?id=38142

            Bug ID: 38142
           Summary: clang++ doesn't diagnose One Reference Rule violation
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangb...@nondot.org
          Reporter: zhong...@pku.org.cn
                CC: dgre...@apple.com, llvm-bugs@lists.llvm.org

The code is as follows:

template<typename>
struct X { };

struct B { };

struct A {
   typedef X<int> X;
};

It is ill-formed but clang++ fails to diagnose
it: The name 'X' refers to different declarations in its
context and when re-evaluated in the completed scope of A.

g++ rejects the code:

1name-lookup2.C.cpp:7:19: error: declaration of 'typedef struct X<int> A::X'
[-fpermissive]
    typedef X<int> X;
                   ^
1name-lookup2.C.cpp:2:8: error: changes meaning of 'X' from 'struct X<int>'
[-fpermissive]
 struct X { };

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to