Title
Operator overloading in constant expressions
Status
nad
Section
7.7 [expr.const]
Submitter
Steve Adamczyk

Created on 2004-11-24.00:00:00 last changed 238 months ago

Messages

Date: 2005-04-15.00:00:00

Rationale (April, 2005):

All expressions, including constant expressions, are subject to overload resolution. The example is ill-formed.

Date: 2022-11-20.07:54:16

According to 7.7 [expr.const] paragraph 1,

In particular, except in sizeof expressions, functions, class objects, pointers, or references shall not be used, and assignment, increment, decrement, function-call, or comma operators shall not be used.

Given a case like

    enum E { e };
    int operator+(int, E);
    int i[4 + e];

does this mean that the overloaded operator+ is not considered (because it can't be called), or is it selected by overload resolution, thus rendering the program ill-formed?

History
Date User Action Args
2005-05-01 00:00:00adminsetmessages: + msg1196
2005-05-01 00:00:00adminsetstatus: open -> nad
2004-11-24 00:00:00admincreate