From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9D4523858C39; Mon, 4 Dec 2023 05:16:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9D4523858C39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1701666988; bh=rfkB0b5PrQ7ulfzU4d36vxvgJieCKiUyufblBe0VUGQ=; h=From:To:Subject:Date:From; b=AdxFA5Qy9ReicKNrZ/TxMqnB5bBODXqy/5YQg/vXJVIVSrXGbqZOSrnAnK6k86t1Y u4sJ3dLxCVJ+xHv0MmpRAziXk8kNGdbJCwEZd4vi48d6D/f3OOJfeXNAXMFEFzub2l 1dFqbo+gEYDZ4I7+oLYCfE/f2d7Kd2m05SGpThbE= From: "luigighiron at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/112841] New: typeof_unqual is not removing qualifiers from array types Date: Mon, 04 Dec 2023 05:16:28 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: luigighiron at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D112841 Bug ID: 112841 Summary: typeof_unqual is not removing qualifiers from array types Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: luigighiron at gmail dot com Target Milestone: --- GCC does not remove qualifiers from array types when used with typeof_unqua= l: puts(_Generic( (typeof_unqual(const int[])*)0, int(*)[]:"non-const", const int(*)[]:"const" )); This should print non-const, but GCC prints const. The latest working draft of the standard includes an example of typeof_unqu= al with an array of const: > EXAMPLE 2 The following program: > const _Atomic int purr =3D 0; > const int meow =3D 1; > const char* const animals[] =3D { > "aardvark", > "bluejay", > "catte", > }; > typeof_unqual(meow) main (int argc, char* argv[]) { > typeof_unqual(purr) plain_purr; > typeof(_Atomic typeof(meow)) atomic_meow; > typeof(animals) animals_array; > typeof_unqual(animals) animals2_array; > return 0; > } > is equivalent to this program: > const _Atomic int purr =3D 0; > const int meow =3D 1; > const char* const animals[] =3D { > "aardvark", > "bluejay", > "catte", > }; > int main (int argc, char* argv[]) { > int plain_purr; > const _Atomic int atomic_meow; > const char* const animals_array[3]; > const char* animals2_array[3]; > return 0; > } Section 6.7.2.5 "Typeof specifiers" Paragraph 7, from N3096 Here, GCC does not not remove the const on the array type for animals2_arra= y in the first part of the example.=