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

            Bug ID: 99885
           Summary: CTAD fails for auto const& NTTP
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ldalessandro at gmail dot com
  Target Milestone: ---

Following (much-reduced) code causes a CTAD failure in gcc but not clang
(https://godbolt.org/z/zWhWGj7PE) with both C++17 and C++20.

template <auto const& A>
struct Foo {};

template <auto const& A>
struct Bar {
    constexpr auto foo() const -> Foo<A> {
        return {};
    }
};

constexpr int a = 1;
constexpr Bar<a> bar;
Foo foo = bar.foo(); // <-- CTAD failure

Reply via email to