Title
Reference binding with ambiguous conversions
Status
drafting
Section
9.4.4 [dcl.init.ref]
Submitter
Hubert Tong

Created on 2014-01-07.00:00:00 last changed 131 months ago

Messages

Date: 2014-02-15.00:00:00

Notes from the February, 2014 meeting:

CWG agreed that an ambiguity like this should make the initialization ill-formed instead of falling through to do indirect binding.

Date: 2014-01-07.00:00:00

In the following case,

  struct A {
    operator int &&() const;
    operator int &&() volatile;
    operator long();
  };

  int main() {
    int &&x = A();
  }

the conversion for direct binding cannot be used because of the ambiguity, so indirect binding is used, which allows the use of the conversion to long in creating the temporary.

Is this intended? There is implementation variation.

History
Date User Action Args
2014-03-03 00:00:00adminsetmessages: + msg4884
2014-03-03 00:00:00adminsetstatus: open -> drafting
2014-01-07 00:00:00admincreate