https://bugs.llvm.org/show_bug.cgi?id=51934
Bug ID: 51934
Summary: class definition not allowed to change meaning of
previously used name
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangb...@nondot.org
Reporter: gonzalo.gades...@gmail.com
CC: blitzrak...@gmail.com, dgre...@apple.com,
erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
richard-l...@metafoo.co.uk
See http://eel.is/c++draft/class.member.lookup#6
[class.member.lookup]/p6: "If it [the result of the search] differs from the
result of a search in T for N from immediately after the class-specifier of T,
the program is ill-formed, no diagnostic required." A class definition is not
allowed to change the meaning of a name that was already used earlier in the
class definition.
While no diagnostic is required, I think a quality implementation like clang
should produce a diagnostic here and reject this program since it is
ill-formed.
Example: https://gcc.godbolt.org/z/zG7Mn1Ebx
struct plus {
template<typename... Args>
using invoke = void;
};
template <typename Fn, typename... Args>
using invoke = typename Fn::template invoke<Args...>;
template <typename Fn>
struct compose
{
template <typename X, typename Y>
using F = invoke<Fn, X, Y>;
template <typename X>
using invoke = invoke<Fn, X, X>;
};
using Q = compose<plus>::F<int, int>;
Is accepted by clang.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs