Skip to content

CWG3133 [over.built] Cv-qualified types in candidate operator functions #800

@eisenwave

Description

@eisenwave

Reference (section label): [over.built]

Issue description

While [over.built] paragraph 7 ensures that only candidates for cv-unqualified floating-point types exists, subsequent paragraphs do not. For example, there exist the candidate operator functions:

float operator*(float, float);
float operator*(const float, float);
float operator*(const volatile float, float);
float operator*(float, const float);
// ...
float operator*(const volatile float, const volatile float);

[over.built] paragraph 11 requires a candidate operator function for every integral type, not just promoted integral types:

std::strong_ordering operator<=>(const volatile bool, const volatile bool);
std::strong_ordering operator<=>(int, int);
std::strong_ordering operator<=>(const int, const int);
// ...

[over.built] paragraph 22 also does not restrict $L$ to cv-unqualified integral types. There exists a case where the vq placeholder means volatile and is combined with $L$, which is already volatile:

char& operator&=(char&, int);
volatile char& operator&=(volatile char&, int);
const volatile char& operator&=(const volatile char&, int);
volatile volatile char& operator&=(volatile volatile char&, int);
// ...

Suggested resolution

Change [over.built] paragraph 10 as follows:

 For every pair of types L and R,
 where each of L and R is a
+cv-unqualified
 floating-point or promoted integral type,
 there exist candidate operator functions of the form ...

Change [over.built] paragraph 11 as follows:

 For every
+promoted
 integral type T there exists a candidate operator function of the form ...

Change [over.built] paragraph 12 as follows:

 For every pair of
+cv-unqualified
 floating-point types L and R,
 there exists a candidate operator function of the form ...

Change [over.built] paragraph 18 as follows:

 For every triple (L , vq, R ),
 where L is an arithmetic type,
 and R is a
+cv-unqualified
 floating-point or promoted integral type,
 there exist candidate operator functions of the form ...

Change [over.built] paragraph 22 as follows:

 For every triple (L , vq, R ), where L is
-an
+a cv-unqualified
 integral type,
 and R is a promoted integral type,
 there exist candidate operator functions of the form

Change [over.built] paragraph 24 as follows:

 For every pair of types L and R,
 where each of L and R is a
+cv-unqualified
 floating-point or promoted integral type,
 there exist candidate operator functions of the form ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions