[llvm-bugs] [Bug 48339] New: Bogus error/note about dependent base classes on template instantiation failure

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Nov 30 14:13:41 PST 2020


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

            Bug ID: 48339
           Summary: Bogus error/note about dependent base classes on
                    template instantiation failure
           Product: clang
           Version: 11.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: wtt6 at cornell.edu
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

The below code is invalid (the template parameter of g cannot be deduced), but
before giving the correct error clang reports

bug.cpp:11:5: error: use of undeclared identifier 'g'
    g(typename T::type{});
    ^
    this->
bug.cpp:16:7: note: in instantiation of function template specialization
'S::f<X>' requested here
  S{}.f<X>();
      ^
bug.cpp:7:15: note: must qualify identifier to find this declaration in
dependent base class
  static void g(typename T::type) {}

which make no sense as there are no base classes here, dependent or otherwise. 
These messages are not present if g is not marked static.


struct X {
  struct type {};
};

struct S {
  template <typename T>
  static void g(typename T::type) {}

  template <typename T>
  void f() {
    g(typename T::type{});
  }
};

void f() {
  S{}.f<X>();
}

-- 
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/20201130/52e0f220/attachment.html>


More information about the llvm-bugs mailing list