[llvm-bugs] [Bug 31047] New: Improve "x is not a class, namespace, or enumeration" diagnostic. When x is a template class.

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Nov 17 15:19:38 PST 2016


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

            Bug ID: 31047
           Summary: Improve "x is not a class, namespace, or enumeration"
                    diagnostic. When x is a template class.
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: peetlugen19 at yandex.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

template<typename T>
struct Base {
  int foo();
};

template<typename T>
struct Derived : Base<T> {
  void bar();
};

template <typename T>
void Derived<T>::bar() {
  Base::foo();
}clang

Clang (-std=c++1z -fsyntax-only -Wall):

./test19.cpp:13:3: error: 'Base' is not a class, namespace, or enumeration
  Base::foo();
  ^
./test19.cpp:2:8: note: 'Base' declared here
struct Base {
       ^
1 error generated.

GCC (v6.2.1):

./test19.cpp: In member function ‘void Derived<T>::bar()’:
./test19.cpp:13:3: error: ‘template<class T> struct Base’ used without template
parameters
   Base::foo();
   ^~~~

It would be nice to have diagnostics like gcc which indicates that Base is
actually a template but it was used without template parameters.

-- 
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/20161117/10939b0f/attachment.html>


More information about the llvm-bugs mailing list