https://bugs.llvm.org/show_bug.cgi?id=52524
Bug ID: 52524
Summary: Ambiguous instantiation while asserting requirement is
not a hard error
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Keywords: accepts-invalid
Severity: enhancement
Priority: P
Component: C++2b
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected],
[email protected]
This came up at https://cpplang.slack.com/archives/C21PKDHSL/p1637078846410400.
>From reading https://wg21.link/LWG3541, it seems that the lack of a
disambiguating specialization should result in a hard error, which does not
happen. See https://godbolt.org/z/vMzPnYvr7.
```C++
#include <concepts>
template<class> struct trait { };
template<class T> concept has_type1 = requires { typename T::type1; };
template<class T> concept has_type2 = requires { typename T::type2; };
template<has_type1 T> struct trait<T> { using type =
typename T::type1; };
template<has_type2 T> struct trait<T> { using type =
typename T::type2; };
template<has_type1 T> requires has_type2<T> and std::same_as<typename T::type1,
typename T::type2>
struct trait<T> { using type = typename T::type1; };
template<class T> concept has_trait_type = requires { typename trait<T>::type;
};
struct Y {
using type1 = double;
using type2 = int;
};
static_assert(not has_trait_type<Y>);
```
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs