Date
2009-11-15.00:00:00
Message id
2540

Content

Proposed resolution (November, 2009):

Add the following paragraph at the end of 9.3.3 [dcl.ambig.res]:

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] [Example:

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

end example]