On Tue, Sep 26, 2017 at 4:28 AM, Paolo Carlini <paolo.carl...@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. What happens if we change the COMPLETE_TYPE_P (type) in cp_apply_type_quals_to_decl to COMPLETE_TYPE_P (complete_type (type))? Jason