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

            Bug ID: 61834
           Summary: __attribute__((may_alias)) causes compilation error
                    with forward-declared constructor
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lopresti at gmail dot com

Created attachment 33135
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33135&action=edit
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

Reply via email to