[llvm-bugs] [Bug 38142] New: clang++ doesn't diagnose One Reference Rule violation
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Jul 11 18:27:53 PDT 2018
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: unassignedclangbugs at nondot.org
Reporter: zhonghao at pku.org.cn
CC: dgregor at apple.com, llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180712/55c7d1fa/attachment.html>
More information about the llvm-bugs
mailing list