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++/36410] New: [4.1/4.2/4.3/4.4 regression] ICE with transparent union


The following code snippet triggers an ICE since GCC 4.3.0:

===========================================
struct A
{
  typedef union
  {
    int i;
  } B __attribute__((transparent_union));
};

void foo(A::B b)
{
  b.i;
}
===========================================

bug.cc: In function 'void foo(A::B)':
bug.cc:11: internal compiler error: in build_base_path, at cp/class.c:272
Please submit a full bug report, [etc.]

GCC 4.2.x emits the following error message:
bug.cc:9: error: non-local function 'void foo(A::<anonymous union>)' uses
anonymous type

GCC 4.1.x also crashes, GCC 3.1 - GCC 4.0.4 reject the code,
and GCC 2.95.x - 3.0.4 accept the code.

Without the attribute the code compiles fine with all versions.

I'm not quite sure whether the code is valid or not. Is A::B really an
anonymous type as the error message in GCC 4.2.x suggests? It has a name
(A::B) after all.
If the code is valid we have a regression since GCC 3.1, if it is invalid we
have a 4.1/4.3/4.4 regression.


-- 
           Summary: [4.1/4.2/4.3/4.4 regression] ICE with transparent union
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code, monitored
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org


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


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