Definition of operator and punctuator
5.12 [lex.operators]
Mike Miller

Created on 1999-12-20.00:00:00 last changed 3 months ago


Date: 2005-04-15.00:00:00

Additional note (April, 2005):

The resolution for this problem should also address the fact that sizeof and typeid (and potentially others like decltype that may be added in the future) are described in some places as “operators” but are not listed in 12.4 [over.oper] paragraph 3 among the operators that cannot be overloaded.

(See also issue 369.)

Date: 2022-02-18.07:47:23

Suggested resolution:

  1. Change 12.4 [over.oper] to use the term overloadable-operator.
  2. Change 5.6 [lex.token] to use the term operator-token instead of operator (since there are operators that are keywords and operators that are composed of more than one token).
  3. Change 5.12 [lex.operators] to define the nonterminals operator-token and punctuator.
Date: 2022-02-18.07:47:23

The nonterminals operator and punctuator in 5.6 [lex.token] are not defined. There is a definition of the nonterminal operator in 12.4 [over.oper] paragraph 1, but it is apparent that the two nonterminals are not the same: the latter includes keywords and multi-token operators and does not include the nonoverloadable operators mentioned in paragraph 3.

There is a definition of preprocessing-op-or-punc in 5.12 [lex.operators] , with the notation that

Each preprocessing-op-or-punc is converted to a single token in translation phase 7 (2.1).
However, this list doesn't distinguish between operators and punctuators, it includes digraphs and keywords (can a given token be both a keyword and an operator at the same time?), etc.
Date User Action Args
2022-02-18 07:47:23adminsetmessages: + msg6644
2005-05-01 00:00:00adminsetmessages: + msg1153
2003-04-25 00:00:00adminsetstatus: open -> drafting
1999-12-20 00:00:00admincreate