Bug 61834 - __attribute__((may_alias)) causes compilation error with forward-declared constructor
Summary: __attribute__((may_alias)) causes compilation error with forward-declared con...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.9.1
: P3 normal
Target Milestone: 6.0
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2014-07-17 18:22 UTC by Patrick J. LoPresti
Modified: 2021-07-23 01:26 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Source file demonstrating bug with may_alias (152 bytes, text/plain)
2014-07-17 18:22 UTC, Patrick J. LoPresti
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick J. LoPresti 2014-07-17 18:22:14 UTC
Created attachment 33135 [details]
Source file demonstrating bug with may_alias

If you compile the attached stand-alone test case with:

  g++ -S may_alias_bug.cc

...it compiles fine.

If you compile with:

  g++ -DBUG -S may_alias_bug.cc

...it produces a compilation error:

  may_alias_bug2.cc:16:8: error: prototype for ‘Thing1::Thing1(Thing2)’ does not match any in class ‘Thing1’



This bug appears to exist at least as far back as GCC 4.4.7. The code compiles fine with Clang and with the Intel C++ compiler, as you can see by experimenting here: http://goo.gl/dDyljx
Comment 1 Andrew Pinski 2021-07-23 01:26:08 UTC
Fixed in GCC 6.1 and above.