Title
[[ appearing in a balanced-token-seq
Status
cd4
Section
9.12.1 [dcl.attr.grammar]
Submitter
Jonathan Caves

Created on 2015-02-03.00:00:00 last changed 94 months ago

Messages

Date: 2015-09-15.00:00:00

Proposed resolution (September, 2015):

Change 9.12.1 [dcl.attr.grammar] paragraph 6 as follows:

Two consecutive left square bracket tokens shall appear only when introducing an attribute-specifier or within the balanced-token-seq of an attribute-argument-clause. [Note: If two consecutive left square brackets appear where an attribute-specifier is not allowed, the program is ill-formed even if the brackets match an alternative grammar production. —end note] [Example:

  int p[10];
  void f() {
    int x = 42, y[5];
    int(p[[x] { return x; }()]);  // error: invalid attribute on a nested
                                  // declarator-id and not a function-style cast of
                                  // an element of p.
    y[[] { return 2; }()] = 2;    // error even though attributes are not allowed
                                  // in this context.

    int i [[vendor::attr([[]])]]; // well-formed implementation-defined attribute.
  }

end example]

Date: 2016-02-15.00:00:00

[Adopted at the February, 2016 meeting.]

According to 9.12.1 [dcl.attr.grammar] paragraph 6,

Two consecutive left square bracket tokens shall appear only when introducing an attribute-specifier. [Note: If two consecutive left square brackets appear where an attribute-specifier is not allowed, the program is ill-formed even if the brackets match an alternative grammar production. —end note]

In order to allow program fragments to appeae within attributes, this restriction should not apply within the balanced-token-seq of an attribute.

History
Date User Action Args
2017-02-06 00:00:00adminsetstatus: tentatively ready -> cd4
2015-11-10 00:00:00adminsetmessages: + msg5600
2015-11-10 00:00:00adminsetstatus: drafting -> tentatively ready
2015-02-03 00:00:00admincreate