[C++ Patch] PR 84644 ("internal compiler error: in warn_misplaced_attr_for_class_type, at cp/decl.c:4718")

Jason Merrill jason@redhat.com
Fri Oct 26 16:28:00 GMT 2018


On Fri, Oct 26, 2018 at 4:52 AM Paolo Carlini <paolo.carlini@oracle.com> wrote:
> On 24/10/18 22:41, Jason Merrill wrote:
> > On 10/15/18 12:45 PM, Paolo Carlini wrote:
> >>         && ((TREE_CODE (declspecs->type) != TYPENAME_TYPE
> >> +       && TREE_CODE (declspecs->type) != DECLTYPE_TYPE
> >>          && MAYBE_CLASS_TYPE_P (declspecs->type))
> >
> > I would think that the MAYBE_CLASS_TYPE_P here should be CLASS_TYPE_P,
> > and then we can remove the TYPENAME_TYPE check.  Or do we want to
> > allow template type parameters for some reason?
>
> Indeed, it would be nice to just use OVERLOAD_TYPE_P. However it seems
> we at least want to let through TEMPLATE_TYPE_PARMs representing 'auto'
> - otherwise Dodji's check a few lines below which fixed c++/51473
> doesn't work anymore - and also BOUND_TEMPLATE_TEMPLATE_PARM, otherwise
> we regress on template/spec32.C and template/ttp22.C because we don't
> diagnose the shadowing anymore. Thus, I would say either we keep on
> using MAYBE_CLASS_TYPE_P or we pick what we need, possibly we add a comment?

Aha.  I guess the answer is not to restrict that test any more, but
instead to fix the code further down so it gives a proper diagnostic
rather than call warn_misplaced_attr_for_class_type.

Jason



More information about the Gcc-patches mailing list