Fix lambda-declarator by kazatsuyu · Pull Request #2333 · cplusplus/draft (original) (raw)

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

@kazatsuyu

The following code is well-formed.

[] () constexpr [[using std:]] noexcept {};

But the following code is currently ill-formed.

[] () [[using std:]] noexcept {};

I think it should be well-formed.

@kazatsuyu

The following code is well-formed.

[] () constexpr [[using std:]] noexcept {};

But the following code is currently ill-formed.

[] () [[using std:]] noexcept {};

I think it should be well-formed.

@zygoloid

I think this is not a correct change: attributes go after the noexcept-specifier, not before.

However, there are two bugs here:

  1. [] () constexpr [[using std:]] noexcept {}; should be ill-formed, but we don't prevent the constexpr decl-specifier from having attributes.
  2. [] () constexpr [[]] {}; is ambiguous, because there are two different _attribute-specifier-seq_s that could consume the attributes.

The fix would be to stop reusing decl-specifier-seq here, but this doesn't seem editorial to me.

@zygoloid

More bugs caused by the reuse of decl-specifier-seq:

@jensmaurer

I think we simply should stop using decl-specifier_seq for lambdas. It was cute when constexpr was introduced, but the fall-out is scary plus we never actually refer to this as a decl-specifier-seq in the text that follows.

@jensmaurer

I have created a clean-up patch; see #2338. I hope to get CWG to review the issue in San Diego.

@zygoloid zygoloid added the not-editorial

Issue is not deemed editorial; the editorial issue is kept open for tracking.

label

Nov 6, 2018

@tkoeppe

@jensmaurer

Yes, the original issue is fixed with P1102R2. The decl-specifier-seq concerns will be addressed by #2338.

Labels

cwg

Issue must be reviewed by CWG.

needs rebase

The pull request needs a git rebase to resolve merge conflicts.

not-editorial

Issue is not deemed editorial; the editorial issue is kept open for tracking.