Skip to content

Invalid private member diagnostic of template using with decltype of private member method #41693

@llvmbot

Description

@llvmbot
Bugzilla Link 42348
Version trunk
OS All
Reporter LLVM Bugzilla Contributor
CC @DougGregor,@smilingthax,@zygoloid

Extended Description

The following code fails to compile with an erroneous error "'Impl' is a private member of 'S'":

  template <typename> struct S
    {
    private:
    template <typename> static constexpr auto Impl();

    public:
    template <typename X> using U = decltype(Impl<X>());
    };

  template <typename T> template <typename>
  constexpr auto S<T>::Impl() { }

  using X = S<void>::U<void>;

The above code compiles in gcc et al. Making the following change allows compilation:

  template <typename> struct S
    {
    private:
    struct W
      {
      template <typename> static constexpr auto Impl();
      };

    public:
    template <typename X> using U = decltype(W::template Impl<X>());
    };

  template <typename T> template <typename>
  constexpr auto S<T>::W::Impl()
    { }

Metadata

Metadata

Assignees

Labels

bugzillaIssues migrated from bugzillac++11clang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second party

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions