Cannot mix GCC and C++ 11 / C23 attribute syntax.

Solution Verified - Updated -

Issue

  • When trying to mix GCC's attribute syntax (__attribute__) with C++11/C23 ([[attribute]]), GCC rejects the code (no matter what the order of the attributes) . GCC code does not compile and throws errors.

  • The C++ parser has trouble combining the C++11 alignas specifier and the GNU __attribute__ specifier in the same class declaration.

Environment

  • Red Hat Enterprise Linux 7.9
  • DTS 11.0

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content