Title
auto as a conversion-type-id
Status
dup
Section
9.2.9.7.1 [dcl.spec.auto.general]
Submitter
Jim X

Created on 2021-03-10.00:00:00 last changed 35 months ago

Messages

Date: 2021-12-15.00:00:00

Rationale (December, 2021):

This issue is a duplicate of issue 1670.

Date: 2022-11-20.07:54:16

Given the example,

  struct A{
   operator auto(){
     return 0;
   }
  };
  int main(){
    A a;
    a.operator auto(); // #1
    a.operator int();  // #2
  }

there is implementation divergence regarding which, if either, of the calls is well-formed. MSVC and clang reject #2, g++ rejects #1, and EDG rejects both.

According to 9.2.9.7.1 [dcl.spec.auto.general] paragraph 6:

A program that uses a placeholder type in a context not explicitly allowed in 9.2.9.7 [dcl.spec.auto] is ill-formed.

The use of auto as a conversion-type-id in a function call is not mentioned in that section; however, the section is dealing with declarative contexts rather than expressions, so it's not clear how much weight that observation should carry.

History
Date User Action Args
2022-01-06 00:00:00adminsetmessages: + msg6623
2022-01-06 00:00:00adminsetstatus: open -> dup
2021-03-10 00:00:00admincreate