[C++ Patch] PR 65579 ("gcc requires definition of a static constexpr member...")

Paolo Carlini paolo.carlini@oracle.com
Tue Oct 24 19:20:00 GMT 2017


Hi Jason,

On 24/10/2017 20:58, Jason Merrill wrote:
> On Tue, Sep 26, 2017 at 4:28 AM, Paolo Carlini <paolo.carlini@oracle.com> wrote:
>> Hi,
>>
>> this is a relatively old bug already analyzed by Martin last year. He also
>> proposed a patch:
>>
>>      https://gcc.gnu.org/ml/gcc-patches/2016-03/msg00593.html
>>
>> After a short exchange Jason proposed a different approach based on simply
>> completing the involved vars:
>>
>>      https://gcc.gnu.org/ml/gcc-patches/2016-03/msg01420.html
>>
>> Having verified that Martin wasn't actively working on the bug, I decided to
>> try a very straightforward implementation of Jason's suggestion - see the
>> attached, tested x86_64-linux - which appears to work fine as-is. Naturally,
>> one could imagine restricting/enlarging the set of decls to complete: some
>> choices don't seem good, like extending to non-constepr vars too (the
>> corresponding snippet is ill formed anyway due to the initialization). I
>> didn't try to test all the possible variants...
> This seems like an odd place to add the complete_type call.
Indeed. Wanted to at least try the minimal change, worked surprisingly well.

>    What
> happens if we change the COMPLETE_TYPE_P (type) in
> cp_apply_type_quals_to_decl to COMPLETE_TYPE_P (complete_type (type))?
I'll let you know asap, thanks for the suggestion!

Paolo.



More information about the Gcc-patches mailing list