OK.

On Tue, Aug 29, 2017 at 11:33 AM, Paolo Carlini
<paolo.carl...@oracle.com> wrote:
> Hi,
>
> in this error recovery regression, we ICE only when optimizing, while
> building the cgraph. Avoiding the reported problem seems easy, just check
> the return value of duplicate_decls in start_decl and immediately return
> back error_mark_node. However, while working on the issue, I noticed
> something slightly more interesting, IMO: we have, after the relevant
> duplicate_decls call:
>
> -              if (decl_spec_seq_has_spec_p (declspecs, ds_constexpr)
> -                  && !DECL_DECLARED_CONSTEXPR_P (field))
> -                error ("%qD declared %<constexpr%> outside its class",
> field);
>
> which I propose to remove. In fact - something I didn't really know - for
> well formed user code, duplicate_decls, near the end, does some memcpys
> which mean that its second argument (would be 'field' in the start_decl
> section we are looking at)  is adjusted to have a DECL_DECLARED_CONSTEXPR_P
> consistent with its first argument. That's of course because we want to
> accept snippets like:
>
> struct A
> {
>   static const int x;
> };
>
> constexpr int A::x = 0;
>
> In turn that means the error above is issued only when something went wrong
> in duplicate_decls in the first place. Thus the above error seems at least
> verbose. However, here in start_decl we are only handling VAR_P (decl), thus
> I don't think the message above even makes sense and could be misleading,
> given snippets like the above. Therefore, I propose to remove the diagnostic
> entirely, which overall also simplifies a patch dealing with c++/70621. The
> below passes testing as-is on x86_64-linux.
>
> Thanks, Paolo.
>
> ////////////////////////
>

Reply via email to