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++/79318] New: conversion member function preceded with & is not marked as error


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

            Bug ID: 79318
           Summary: conversion member function preceded with & is not
                    marked as error
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc at mailinator dot com
  Target Milestone: ---

See example and discussion on
https://stackoverflow.com/questions/41954449/what-does-gccs-conversion-function-operator-int-do

Conversion member function declaration like

&operator int ();

does not produce a warning or error and is interpreted as

operator int& ();

by GCC. It fails on e.g. CLANG. 
Usage of & in front of operator seems not to be covered by the language
definition.

Verified up to gcc 6.3.

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