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

            Bug ID: 88893
           Summary: Forward declaring of enum class with visibility
                    results in -Wattributes false positive.
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Predelnik at gmail dot com
  Target Milestone: ---

The following program 

enum class azaza;
enum class __attribute__ ((visibility ("default"))) azaza
{
};

compiled with no arguments gives:
<source>:2:53: warning: type attributes ignored after type is already defined
[-Wattributes]

    2 | enum class __attribute__ ((visibility ("default"))) azaza

      |                                                     ^~~~~

Since making enum classes visible may be needed w.r.t libc++ type_info
behavior. This warning turns out to be a bit annoying in this case since
clang++ compiles code fine.

This problem was partially fixed in
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43407
But with forward declaration old behavior still shows through.

Reply via email to