2
votes

N3797 §13.3.3.1 [over.best.ics] says:

The sequence of conversions is an implicit conversion as defined in Clause 4 [...]

However, clause 4 defines the following list of the conversions:

  • Lvalue-to-rvalue conversion
  • Array-to-pointer conversion
  • Function-to-pointer conversion
  • Qualification conversions
  • Integral promotions
  • Floating point promotion
  • Integral conversions
  • Floating point conversions
  • Floating-integral conversions
  • Pointer conversions
  • Pointer to member conversions
  • Boolean conversions
  • Integer conversion rank

Consider the following example:

#include <iostream>

using namespace std;

struct A
{
    operator int()
    {
        return 42;
    }
};

A a;

int b = a; //User-defined conversion sequence applied

int main() { }

As long as user-defined conversion doesn't belong to a set of standard conversions, there is no any standard conversion being applied in the example. So what is the sense of the quote I provided?

1

1 Answers

0
votes

The rest of the quote you omitted might be illuminating:

§13.3.3.1/1 An implicit conversion sequence is a sequence of conversions used to convert an argument in a function call to the type of the corresponding parameter of the function being called. The sequence of conversions is an implicit conversion as defined in Clause 4, which means it is governed by the rules for initialization of an object or reference by a single expression (8.5, 8.5.3).

Clause 4 does indeed talk about this.

3 An expression e can be implicitly converted to a type T if and only if the declaration T t=e; is well-formed, for some invented temporary variable t (8.5).

6 The effect of any implicit conversion is the same as performing the corresponding declaration and initialization and then using the temporary variable as the result of the conversion. The result is an lvalue if T is an lvalue reference type or an rvalue reference to function type (8.3.2), an xvalue if T is an rvalue reference to object type, and a prvalue otherwise. The expression e is used as a glvalue if and only if the initialization uses it as a glvalue.

The "full set of such conversions" (listed in Clause 4) refers to standard conversions. Remember that it says standard conversion sequences can be empty. Then §13.3.3.1.2 describes user-defined conversion sequences. It consists of:

  • A standard conversion sequence
  • A user-defined conversion
  • Another standard conversion sequence