summaryrefslogtreecommitdiff
path: root/tests/headers.at
diff options
context:
space:
mode:
authorAkim Demaille <akim.demaille@gmail.com>2019-01-14 19:57:02 +0100
committerAkim Demaille <akim.demaille@gmail.com>2019-01-15 07:10:29 +0100
commita049509d0437046e57a0e96f71452ddb33f8eecc (patch)
treec523c4fd42c7c5b7ff4dc0bf742e93aef4b83b6b /tests/headers.at
parent7c5e508b3984cbebdc7b5abf741410a5e5c6051c (diff)
downloadbison-a049509d0437046e57a0e96f71452ddb33f8eecc.tar.gz
c++: avoid -Wundefined-func-template warnings from clang
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.
Diffstat (limited to 'tests/headers.at')
-rw-r--r--tests/headers.at2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/headers.at b/tests/headers.at
index 32c8d856..a58074fe 100644
--- a/tests/headers.at
+++ b/tests/headers.at
@@ -125,7 +125,7 @@ AT_BISON_OPTION_PUSHDEFS([$1])
AT_DATA_GRAMMAR([input.y],
[[$1
%define parse.error verbose
-]AT_VARIANT_IF([], [%union {int integer;}])[
+]AT_VARIANT_IF([%token <int> 'x'], [%union {int integer;}])[
%code {
]AT_PUSH_IF([[
#if defined __GNUC__ && 7 == __GNUC__