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

            Bug ID: 124655
           Summary: Invalid string literal concatenation is accepted
                    inside of ignored attributes
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: luigighiron at gmail dot com
  Target Milestone: ---

The following code is incorrectly accepted by GCC:

[[unknown::attribute(L""U"")]]int main(){}

> If a sequence of adjacent string literal tokens includes prefixed string
> literal tokens, the prefixed tokens shall all have the same prefix.

Section 6.4.5 "String literals" Paragraph 2 ISO/IEC 9899:2024

L""U"" is invalid even in ignored attributes. Clang and MSVC have the same
issue. This issue also applies to C++ when a space is added between the string
literals L"" U"", including in Clang and MSVC too. EDG rejects L"" U"" even in
ignored attributes. MSVC even accepts it in attributes that are not ignored,
for example [[nodiscard(L"" U"")]].

Reply via email to