public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/53421] New: __attribute((__may_alias__)) prevents taking address of conversion operator member function
@ 2012-05-19 21:26 jeffrey.hellrung at gmail dot com
  2015-08-13 15:34 ` [Bug c++/53421] __attribute__((__may_alias__)) " paolo.carlini at oracle dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: jeffrey.hellrung at gmail dot com @ 2012-05-19 21:26 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53421

             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=27446
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 ‘int main(int, char**)’:
main.cpp:21:6: error: ‘operator Y<X>&’ is not a member of ‘X’

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 ‘X::operator Y<X>&()’ member function declared in
class ‘X’

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)).


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/53421] __attribute__((__may_alias__)) prevents taking address of conversion operator member function
  2012-05-19 21:26 [Bug c++/53421] New: __attribute((__may_alias__)) prevents taking address of conversion operator member function jeffrey.hellrung at gmail dot com
@ 2015-08-13 15:34 ` paolo.carlini at oracle dot com
  2015-08-13 15:46 ` paolo.carlini at oracle dot com
  2015-08-13 15:46 ` paolo at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-08-13 15:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
This is fixed in mainline. I'm adding two testcases and closing the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/53421] __attribute__((__may_alias__)) prevents taking address of conversion operator member function
  2012-05-19 21:26 [Bug c++/53421] New: __attribute((__may_alias__)) prevents taking address of conversion operator member function jeffrey.hellrung at gmail dot com
  2015-08-13 15:34 ` [Bug c++/53421] __attribute__((__may_alias__)) " paolo.carlini at oracle dot com
  2015-08-13 15:46 ` paolo.carlini at oracle dot com
@ 2015-08-13 15:46 ` paolo at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: paolo at gcc dot gnu.org @ 2015-08-13 15:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Thu Aug 13 15:45:37 2015
New Revision: 226868

URL: https://gcc.gnu.org/viewcvs?rev=226868&root=gcc&view=rev
Log:
2015-08-13  Paolo Carlini  <paolo.carlini@oracle.com>

        PR c++/53421
        * g++.dg/ext/attribute-may-alias-1.C: New.
        * g++.dg/ext/attribute-may-alias-2.C: Likewise.

Added:
    trunk/gcc/testsuite/g++.dg/ext/attribute-may-alias-1.C
    trunk/gcc/testsuite/g++.dg/ext/attribute-may-alias-2.C
Modified:
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/53421] __attribute__((__may_alias__)) prevents taking address of conversion operator member function
  2012-05-19 21:26 [Bug c++/53421] New: __attribute((__may_alias__)) prevents taking address of conversion operator member function jeffrey.hellrung at gmail dot com
  2015-08-13 15:34 ` [Bug c++/53421] __attribute__((__may_alias__)) " paolo.carlini at oracle dot com
@ 2015-08-13 15:46 ` paolo.carlini at oracle dot com
  2015-08-13 15:46 ` paolo at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-08-13 15:46 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |6.0

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Done.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-08-13 15:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-19 21:26 [Bug c++/53421] New: __attribute((__may_alias__)) prevents taking address of conversion operator member function jeffrey.hellrung at gmail dot com
2015-08-13 15:34 ` [Bug c++/53421] __attribute__((__may_alias__)) " paolo.carlini at oracle dot com
2015-08-13 15:46 ` paolo.carlini at oracle dot com
2015-08-13 15:46 ` paolo at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).