From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25883 invoked by alias); 19 May 2012 21:26:36 -0000 Received: (qmail 25873 invoked by uid 22791); 19 May 2012 21:26:35 -0000 X-SWARE-Spam-Status: No, hits=-3.6 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 19 May 2012 21:26:22 +0000 From: "jeffrey.hellrung at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/53421] New: __attribute((__may_alias__)) prevents taking address of conversion operator member function Date: Sat, 19 May 2012 21:26:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jeffrey.hellrung at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-05/txt/msg01895.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D53421 Bug #: 53421 Summary: __attribute((__may_alias__)) prevents taking address of conversion operator member function Classification: Unclassified Product: gcc Version: 4.6.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: jeffrey.hellrung@gmail.com Created attachment 27446 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=3D27446 source file exhibiting the bug when compiled Compiling attached main.cpp gives the following error: jeffrey@ubuntu:~/scratch$ g++ -o scratch main.cpp main.cpp: In function =E2=80=98int main(int, char**)=E2=80=99: main.cpp:21:6: error: =E2=80=98operator Y&=E2=80=99 is not a member of = =E2=80=98X=E2=80=99 However, no error occurs with any of the following changes: (a) Removing the __attribute__((__may_alias__)) (commenting in line 3 and commenting out line 4). (b) Removing the implementation (line 8) or using a throwing implementation (line 9) rather than the present implementation (line 10). (c) Replacing the conversion operator with a regular member function (commenting out lines 10,21 and commenting in lines 11,22 or 12,22. Further investigation reveals a possibly related error. One can define the function out-of-line (commenting in lines 8,16 and commenting out line 10) = with no error, as long as line 15 remains commented out; additionally commenting= in line 15 gives the following error: jeffrey@ubuntu:~/scratch$ g++ -o scratch main.cpp main.cpp:16:20: error: no =E2=80=98X::operator Y&()=E2=80=99 member func= tion declared in class =E2=80=98X=E2=80=99 This error still appears if one uses a throwing implementation (like in (b)= ) or replaces the conversion operator with a regular member function (like in (c= )), but no error occurs with the removal of the __attribute__((__may_alias__)) = (as in (a)).