This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/80994] New: Misleading error message for missing template keyword
- From: "eugene at hutorny dot in.ua" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 07 Jun 2017 06:50:29 +0000
- Subject: [Bug c++/80994] New: Misleading error message for missing template keyword
- Auto-submitted: auto-generated
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(' ');
}