[Bug c++/79192] Angle bracket following typename is treated as template argument delimiter even if the name is not a template name
ricilake at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Jan 23 20:35:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79192
--- Comment #1 from ricilake at gmail dot com ---
Thanks to Johannes Schaub-litb (via SO), the problem appears to be at around
line 16781 of cp/parser.c:
/* There is no valid C++ program where a non-template type is
followed by a "<". That usually indicates that the user thought
that the type was a template. */
cp_parser_check_for_invalid_template_id (parser, type, none_type,
token->location);
I believe this comment (and the subsequent call to
cp_parser_check_for_invalid_template_id) is incorrect; the above program is
valid.
As Johannes points out, there are other valid C++ programs in which a less than
sign can follow a non-template type, such as the following, which also triggers
the same error: (condensed from Johannes'
http://coliru.stacked-crooked.com/a/f35c1aa5b3f9832d)
struct A { operator A(); };
void operator<(A (A::*)(), A);
int main() { &A::operator A < A(); }
More information about the Gcc-bugs
mailing list