[Bug c++/88600] New: GCC rejects attributes on type aliases, while clang accepts them

hubicka at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Dec 26 16:32:00 GMT 2018


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

            Bug ID: 88600
           Summary: GCC rejects attributes on type aliases, while clang
                    accepts them
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hubicka at gcc dot gnu.org
  Target Milestone: ---

Compiling:

template <typename T> using V = __attribute__ ((__vector_size (8))) T;

with GCC leads to:

tt.C:1:69: warning: ignoring attributes applied to dependent type ‘T’ without
an associated declaration [-Wattributes]
 template <typename T> using V = __attribute__ ((__vector_size (8))) T;
                                                                     ^

while clang produces type V which is vector of integers. This is used by
templates in Skia library which I am not sure how to write w/o this construct:

    // These are __m256 and __m256i, but friendlier and strongly-typed.
    template <typename T> using V = T __attribute__((ext_vector_type(8)));
    using F   = V<float   >;
    using I32 = V< int32_t>;
    using U64 = V<uint64_t>;
    using U32 = V<uint32_t>;
    using U16 = V<uint16_t>;
    using U8  = V<uint8_t >;

I am not sure how to do the same in a way compatible with GCC.


More information about the Gcc-bugs mailing list