mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
Reported by Derek Clegg. http://lists.gnu.org/archive/html/bug-bison/2019-01/msg00006.html Clang does not like this: template <typename D> struct basic_symbol : D { basic_symbol(); }; struct by_type {}; struct symbol_type : basic_symbol<by_type> { symbol_type(){} }; It gives: $ clang++-mp-7.0 -Wundefined-func-template foo.cc -c foo.cc:11:3: warning: instantiation of function 'basic_symbol<by_type>::basic_symbol' required here, but no definition is available [-Wundefined-func-template] symbol_type(){} ^ foo.cc:4:3: note: forward declaration of template entity is here basic_symbol(); ^ foo.cc:11:3: note: add an explicit instantiation declaration to suppress this warning if 'basic_symbol<by_type>::basic_symbol' is explicitly instantiated in another translation unit symbol_type(){} ^ 1 warning generated. The same applies for the basic_symbol's destructor and `clear()`. * configure.ac (warn_cxx): Add -Wundefined-func-template. This triggered one failure in the test suite: * tests/headers.at (Sane headers): here, where we check that we can compile the generated headers in other compilation units than the parser's. Add a variant type to make sure that basic_symbol and symbol_type are properly generated in this case. * data/skeletons/c++.m4 (basic_symbol): Inline the definitions of the destructor and of `clear` in the class definition.
8.0 KiB
8.0 KiB