This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/61663] New: [DR 976] Deduction for const T& conversion functions


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61663

            Bug ID: 61663
           Summary: [DR 976] Deduction for const T& conversion functions
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: david.d.kretzmer at gmail dot com

GCC 4.9.0 rejects the following code:

struct F 
{
  template<class T>
  operator const T&() { static T t; return t; }
};

int main() 
{
  F f;
  int i = f;   // error: cannot convert 'F' to 'int' in initialization
}

As explained in the defects report
(http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#976) this used to
be invalid but after the corrections in 14.8.2.3 [temp.deduct.conv] paragraphs
1-3 the above code should compile.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]