https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78502
Bug ID: 78502
Summary: Analyze 'final'/'override' even for uninstantiated
class templates
Product: gcc
Version: 6.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jengelh at inai dot de
Target Milestone: ---
This is a feature request for a future version.
gcc 6.x currently misses to warn about nonderivable classes of templates that
are left uninstantiated:
$ cat t.cpp
class A final {};
template<typename T> class B : public A {};
Observed:
$ g++-6 t.cpp -std=gnu++11 -c -Wall
$
(no diagnostics)
Expected:
Clang 3.7.0:
$ clang++ -std=gnu++11 -c -Wall t.cpp
t.cpp:2:39: error: base 'A' is marked 'final'
template<typename T> class B : public A {};
Coverity 8.5.0.5:
$ cov-build g++ -std=gnu++11 -c -Wall t.cpp
"t.cpp", line 2: error #1920: a "final" class type cannot be used as a base
class
class B : public A {
gcc version 6.2.1 20161121 [gcc-6-branch revision 242657] (SUSE Linux)