[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: -Wweak-vtables warnings (was: Bison 3.2.91 released [beta])
From: |
Derek Clegg |
Subject: |
Re: -Wweak-vtables warnings (was: Bison 3.2.91 released [beta]) |
Date: |
Sun, 20 Jan 2019 07:02:27 -0800 |
Hi, Akim —
On Jan 19, 2019, at 11:49 PM, Akim Demaille <address@hidden> wrote:
>
> Hi Derek!
>
>> Le 19 janv. 2019 à 20:47, Derek Clegg <address@hidden> a écrit :
>>
>> I ran into just one issue:
>>
>> aux/parser-internal.h:429:12: error: 'syntax_error' has no out-of-line
>> virtual
>> method definitions; its vtable will be emitted in every translation unit
>> [-Werror,-Wweak-vtables]
>> struct syntax_error : std::runtime_error
>> ^
>> 1 error generated.
>
> I don't think I will address this warning, the cure is way worse than the
> problem.
>
> To add the destructor, I must make the signature explicit, and it cannot be
> different from the one in the base class, so I must add noexcept:
>
> ~syntax_error () YY_NOEXCEPT;
In C++98 the signature is
virtual ~exception() throw();
and in C++11 the signature is
virtual ~exception();
so this only has to be handled specially for C++98.
Wouldn’t it be sufficient to explicitly write
#if 201103L <= YY_CPLUSPLUS
~syntax_error();
#else
~syntax_error() throw();
#endif
and similarly for the definition?
It seems problematic to redefine YY_NOEXCEPT, especially since “noexcept” and
“throw()” aren’t used equivalently.
Derek
Re: [Bison-Announce] Bison 3.2.91 released [beta], Frank Heckenbach, 2019/01/20