diff options
author | Nathaniel Shead <nathanieloshead@gmail.com> | 2024-03-04 22:59:56 +1100 |
---|---|---|
committer | Nathaniel Shead <nathanieloshead@gmail.com> | 2024-08-07 11:49:46 +1000 |
commit | b7f719612515a86d1d2a36e24b02ade3f0904e10 (patch) | |
tree | 59fe8cb02501cde6f0e36b0609f07cb48422700f /gcc/tree-iterator.cc | |
parent | 8fac69a2dbff98ebe1feb87faba0d9b81a173c40 (diff) | |
download | gcc-b7f719612515a86d1d2a36e24b02ade3f0904e10.zip gcc-b7f719612515a86d1d2a36e24b02ade3f0904e10.tar.gz gcc-b7f719612515a86d1d2a36e24b02ade3f0904e10.tar.bz2 |
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>
Diffstat (limited to 'gcc/tree-iterator.cc')
0 files changed, 0 insertions, 0 deletions