[llvm-bugs] [Bug 42348] New: Invalid private member diagnostic of template using with decltype of private member method

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jun 20 13:13:04 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=42348

            Bug ID: 42348
           Summary: Invalid private member diagnostic of template using
                    with decltype of private member method
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: andyg1001 at hotmail.co.uk
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

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

  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()
    { }

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190620/f0764cc5/attachment-0001.html>


More information about the llvm-bugs mailing list