On Wed, Aug 07, 2019 at 12:32:54PM -0400, Jason Merrill wrote:
> On Tue, Aug 6, 2019, 11:28 PM Marek Polacek <pola...@redhat.com> wrote:
> 
> > In this PR, we are wrongly parsing a constructor if its first parameter
> > begins
> > with a C++11 attribute, e.g.:
> >
> >   struct S {
> >     S([[maybe_unused]] int a) { }
> >   };
> >
> > If the GNU attribute format is used instead, there's no problem.
> > C++11-style
> > attribute on a later parameter is fine also.
> >
> > The problem is in cp_parser_constructor_declarator_p, in particular the
> > code
> > that checks whether we're dealing with something like "S (f) (int);", which
> > is not a constructor.  We're checking if what comes after the first '(' is
> > either ')', "...", of a parameter decl.  A parameter decl can start with
> > the
> > "attribute" keyword, which cp_lexer_next_token_is_decl_specifier_keyword
> > recognizes, but a parameter decl can also start with a C++11-style
> > attribute,
> > which we forgot to realize.
> >
> > The first test uses -Wunused-parameter in order to check that the attribute
> > is in effect.
> >
> > And I also noticed that we don't issue a pedwarn about maybe_unused (C++17
> > attribute) in C++14: PR 91382.
> >
> 
> Since unsupported attributes are supposed to be ignored, I don't think we
> need to complain.

Yup, I already closed the bug.

> The patch is ok.

Thanks!

Marek

Reply via email to