https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120161
Bug ID: 120161
Summary: Deduction failure with nested dependent type
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
Consider this program, which is a reduction of attempting to use Boost.Mp11's
mp_map_find:
template <typename... T> struct mp_list { };
template<typename T>
struct Wrap {
struct type { };
};
#if 0
template <typename T> using C = T; // works
#else
template <typename T> using C = typename Wrap<T>::type; // fails
#endif
struct U : mp_list<C<int>, void>
, mp_list<C<long>, void>
{ };
template <class... U> static auto f(mp_list<C<int>, U...>*) -> int;
static auto f(...) -> char;
static_assert(__is_same(decltype(f(static_cast<U*>(nullptr))), int));
When C<T> is just defined as T (flip the preprocessor), this check works. When
C<T> is defined as Wrap<T>::type, it fails on gcc 14 and gcc 15 (although it
pass on gcc 13, gcc 12, etc.). It passes on clang either way.
I don't think the particular spelling of C<int> should matter here (as long as
C<int> and C<long> are distinct types).