This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/80994] New: Misleading error message for missing template keyword


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

            Bug ID: 80994
           Summary: Misleading error message for missing template keyword
           Product: gcc
           Version: 7.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eugene at hutorny dot in.ua
  Target Milestone: ---

The example below fails to compile with error 
error: invalid operands of types '<unresolved overloaded function type>' and
'int' to binary 'operator<'

which seems to be misleading. A message like 'template keyword needed' would be
much more informative.

template<int count>
struct zoo {
        template<int ID>
        int bar(char in);
};

template<typename ... L>
class foo {
public:
        foo();
        inline int bar(char chr) {
                return fos.bar<0>(chr); // must be: return fos.template
bar<0>(chr);
        }
        zoo<sizeof...(L)> fos;
};

int main() {
        foo<int, char> tar;
        return tar.bar(' ');
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]