-
- Downloads
c++: Improve fixits for incorrect explicit instantiations
When forgetting the '<>' on an explicit specialisation, the suggested
fixit hint suggests to add 'template <>', but naively applying will
cause nonsense results like 'template template <> struct S<int> {};'.
Instead check if we're currently parsing an explicit instantiation, and
if so inform about the issue (an instantiation cannot have a class body)
and suggest a fixit of simply '<>' to create a specialisation instead.
gcc/cp/ChangeLog:
* parser.cc (cp_parser_class_head): Clarify error message for
explicit instantiations.
gcc/testsuite/ChangeLog:
* g++.dg/template/explicit-instantiation9.C: New test.
Signed-off-by:
Nathaniel Shead <nathanieloshead@gmail.com>
Loading
Please register or sign in to comment