https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124617

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Somewhat reduced test which EDG accepts, clang++ rejects.

```
#include <meta>

template <class R, class F>
struct S {
    template <int I, int J>
    static constexpr auto visit(F&& f) -> R {
        return 42;
    }

    static constexpr auto get_array() {
        return ^^visit<0,0>;
    }

    using Ptr = decltype(&visit<0, 0>);
    static constexpr std::meta::info fptrs = get_array();
};

template <class R, class F>
constexpr auto visit2(F&& f) -> R {
    using Impl = S<R, F>;
    auto which = Impl::fptrs;
    //__builtin_constexpr_diag(0, "aa", display_string_of(type_of(which)));
    //__builtin_constexpr_diag(0, "bb", display_string_of(dealias(^^typename
Impl::Ptr)));
    auto func = std::meta::extract<typename Impl::Ptr>(which);
    return func((F&&)f);
}

struct Plus {
    consteval auto operator()(auto x, auto y) const {
        return x + y;
    }
};

static_assert(visit2<int>(Plus{}) == 42);
```

Reply via email to