https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77618
Bug ID: 77618
Summary: warn for explicit instantiation that occurs after an
explicit specialization
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: trippels at gcc dot gnu.org
Target Milestone: ---
clang has a nice warning:
% cat foo.ii
template <typename T> void foo() {}
template <> void foo<int>() {}
template void foo<int>();
% clang++ -c foo.ii
foo.ii:3:15: warning: explicit instantiation of 'foo<int>' that occurs after an
explicit specialization has no effect [-Winstantiation-after-specialization]
template void foo<int>();
^
foo.ii:2:18: note: previous template specialization is here
template <> void foo<int>() {}
^
1 warning generated.
Would be nice to have in gcc, too.