Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/2222700/?format=api
{ "id": 2222700, "url": "http://patchwork.ozlabs.org/api/1.2/patches/2222700/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260413131604.24142-2-yronglin777@gmail.com/", "project": { "id": 17, "url": "http://patchwork.ozlabs.org/api/1.2/projects/17/?format=api", "name": "GNU Compiler Collection", "link_name": "gcc", "list_id": "gcc-patches.gcc.gnu.org", "list_email": "gcc-patches@gcc.gnu.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260413131604.24142-2-yronglin777@gmail.com>", "list_archive_url": null, "date": "2026-04-13T13:16:05", "name": "[v3] c-family, cp: introduce alignof_kind enum for accurate alignof/alignas diagnostics [PR124601]", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "2943ebdcf3bf058b0621c00ab07e01003b3e90d3", "submitter": { "id": 91424, "url": "http://patchwork.ozlabs.org/api/1.2/people/91424/?format=api", "name": "Yrong", "email": "yronglin777@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20260413131604.24142-2-yronglin777@gmail.com/mbox/", "series": [ { "id": 499703, "url": "http://patchwork.ozlabs.org/api/1.2/series/499703/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=499703", "date": "2026-04-13T13:16:05", "name": "[v3] c-family, cp: introduce alignof_kind enum for accurate alignof/alignas diagnostics [PR124601]", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/499703/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2222700/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2222700/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "gcc-patches@gcc.gnu.org" ], "Delivered-To": [ "patchwork-incoming@legolas.ozlabs.org", "gcc-patches@gcc.gnu.org" ], "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=nJgnHYwP;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=38.145.34.32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)", "sourceware.org;\n\tdkim=pass (2048-bit key,\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=nJgnHYwP", "sourceware.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com", "sourceware.org; spf=pass smtp.mailfrom=gmail.com", "server2.sourceware.org;\n arc=none smtp.remote-ip=209.85.216.42" ], "Received": [ "from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fvSck1TD2z1xtJ\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 13 Apr 2026 23:17:24 +1000 (AEST)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id C92CD4BA2E1C\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 13 Apr 2026 13:17:22 +0000 (GMT)", "from mail-pj1-f42.google.com (mail-pj1-f42.google.com\n [209.85.216.42])\n by sourceware.org (Postfix) with ESMTPS id 7504C4BA2E0F\n for <gcc-patches@gcc.gnu.org>; Mon, 13 Apr 2026 13:16:48 +0000 (GMT)", "by mail-pj1-f42.google.com with SMTP id\n 98e67ed59e1d1-35fb16e56efso787045a91.2\n for <gcc-patches@gcc.gnu.org>; Mon, 13 Apr 2026 06:16:48 -0700 (PDT)", "from localhost ([2409:891f:8f40:e8e9:ecd7:c98a:884a:9425])\n by smtp.gmail.com with ESMTPSA id\n d9443c01a7336-2b2d4f0982fsm113232325ad.39.2026.04.13.06.16.44\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Mon, 13 Apr 2026 06:16:46 -0700 (PDT)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org C92CD4BA2E1C", "OpenDKIM Filter v2.11.0 sourceware.org 7504C4BA2E0F" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 7504C4BA2E0F", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 7504C4BA2E0F", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776086208; cv=none;\n b=R6JwIA52BFmOyYHA+NZh7l4Ja45XQOZmf7k2P5f0LupMNEzCoHuGOaQwnov94a4ghVU0ZnteG8/XvaXtAXHx9bT0TAHTEGFrgDBYLrQQQNeG5b5nr1RAUJw8U/9ktSjZLXRJZC8aPXr0er8JovfNmCqyY7YJ6KTEKA1d9Qehyqc=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776086208; c=relaxed/simple;\n bh=/yNWLGHwWTyLFI6JppI8E0W0eBNrYpuDlMf6M7E74Cs=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=bObq+ycy2Czybrr6HgmV02JByiVrL0rPCKc1s9zk5dTOa29XzPU1dDIwcMAXpXs+0Igunrvg1otE/ptlRbmkqB5i0yHGpvoa3Osh83Xw37X4zSYtJPVlwOAcZO60XB6+ElljTraIAQGWOaT12fpia5tW1jXOKe2vrxttZ0TzpA4=", "ARC-Authentication-Results": "i=1; server2.sourceware.org", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1776086207; x=1776691007; darn=gcc.gnu.org;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:from:to:cc:subject:date:message-id:reply-to;\n bh=ejAUESjK5GR4bZHBQ/EbSt1K52is4WYuZbfRV+Jp0/I=;\n b=nJgnHYwPyRaMkRal1A5TwmQhuPTS2DyUb5tosmaRqbYbVfmX2jK6BlauEyncW5YC3o\n gfqS+0KtkRS8Qy0AVDS9r+Ic2A2At3n3xzEaFdQMsQZDpsktNSrNDIvm4B3mYqlVCOkg\n g3mfd+0jOKFcPAP1LMUxMu5vh/PS2BHlyfQYISZ5l/H9Ezurc38L1np8ZcA5gQlkQgEP\n 4N1prPeQvRyBZyxhxE6N5QWXebqV8veH5QFjsoL9Z54tpAYjPnm1t3GZ8JGzplJFdQyp\n OHtOX0nm3F/G1GFfDHhlkfieI0vh7nGBTxZxI8z3yDoPV6lacVdi5UFtZpcbWsuLalWG\n 3kww==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776086207; x=1776691007;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n :message-id:reply-to;\n bh=ejAUESjK5GR4bZHBQ/EbSt1K52is4WYuZbfRV+Jp0/I=;\n b=tWlg0E5GqR9fz4XsBpHEQ0begEHnvhFuXe3vcD/k17U0R4B83/PIgNOB1F7Ry8Cq9f\n oaimEUU9Dy/QNTojV9N6HYxJRuBgU7ShiN8zdOEvwV1bhofdpHJveDrl7jsPA9jSgaU/\n a1BBDbfDCQCin5HzDySyBorxpxzdIEgy0okBhgZmBqP7BEK1u3TDeDWMdsYh6r4ilNbG\n wKW59vCcHVr8vEDqQq0MKBklDcCaGXePwO4OsAx/jf1cpjxTVpUgOVpYjegMPTN2YtAM\n H9l84hoWH0Svh1DfrBUfi1bfi63Y3v6K9rMNULvE+d+OlJNywU6pFqMcmqa2dU0s5ACc\n 8RDg==", "X-Gm-Message-State": "AOJu0YwWtjsKnds/R825BN0qWaeBdNzA4fcxJkfp4WUWRuaTswbzQFys\n g16+5hin7nFVSdLferelRrAF7NYegbywCht18lG902u525Dx8+SXUeuzygIa6KaxuVqfmx/3", "X-Gm-Gg": "AeBDiev3Zuv8NWFTAo1793tbBOaERurvW5hJyB2rqU5DdW7oQwxSCtjetwTMh/NrwEa\n jfH8V+VUrFwG5D58o3Rn1fkyFZjpRjuYAC0weXy3R9+F8N3JIGhBFAyozGp+KhOZhqr+urqtESv\n T0T7/Jjkg41vii3RfHouTUDLQ7QsrlE1F4md3waEI/pV2IxAGScWbjNDAG5/TUSYH1bBe3S/OH7\n xUEisEEshd/A55R1FrqxamHn8+EKnFbYrju8mRvXCY0ppJmhljUweCA0L9KWq3U8pUoAifBm42y\n qWPYXa4gWrjsaTA/gLS8DtzUs+0wK6e+LzGQ10GjGx5rBYavJa+uDt2Ho8XRoQQZ+Ke/GrgkYqM\n 9vTCUsUOV3JKbp65hdiQbx5y7NAEXznnZ1r8MVbYzCtpGLeG9k8Q1qHLpPtEQFYEt1KH+o8yHcH\n QMu1nOkVzFPrI4pKoSb1JFdkeD", "X-Received": "by 2002:a17:90b:17d0:b0:359:fe72:3559 with SMTP id\n 98e67ed59e1d1-35e42883e2cmr14558485a91.21.1776086206608;\n Mon, 13 Apr 2026 06:16:46 -0700 (PDT)", "From": "yronglin777@gmail.com", "To": "gcc-patches@gcc.gnu.org", "Cc": "jason@redhat.com,\n\tpolacek@redhat.com,\n\tyronglin <yronglin777@gmail.com>", "Subject": "[PATCH v3] c-family,\n cp: introduce alignof_kind enum for accurate alignof/alignas\n diagnostics [PR124601]", "Date": "Mon, 13 Apr 2026 21:16:05 +0800", "Message-ID": "<20260413131604.24142-2-yronglin777@gmail.com>", "X-Mailer": "git-send-email 2.43.0", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-BeenThere": "gcc-patches@gcc.gnu.org", "X-Mailman-Version": "2.1.30", "Precedence": "list", "List-Id": "Gcc-patches mailing list <gcc-patches.gcc.gnu.org>", "List-Unsubscribe": "<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>", "List-Archive": "<https://gcc.gnu.org/pipermail/gcc-patches/>", "List-Post": "<mailto:gcc-patches@gcc.gnu.org>", "List-Help": "<mailto:gcc-patches-request@gcc.gnu.org?subject=help>", "List-Subscribe": "<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>", "Errors-To": "gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org" }, "content": "From: yronglin <yronglin777@gmail.com>\n\nDiagnostic code for invalid uses of alignof/alignas currently\nhard-codes or infers the reported keyword from a boolean, which can\nlead to incorrect diagnostics (e.g. reporting alignof or\n__alignof for _Alignas or _Alignof).\n\nIntroduce enum class alignof_kind to represent the originating keyword\nand propagate it through c_sizeof_or_alignof_type and\ncxx_sizeof_or_alignof_type, so diagnostics can refer to the correct\nspelling. This covers all variants: C++ alignof/alignas, C11\n_Alignof/_Alignas, C23 alignof/alignas, and GNU\n__alignof.\n\nIn the C++ front end, also record the kind in ALIGNOF_EXPR\n(TREE_LANG_FLAG_2/1/0) so template instantiation and pretty-printing\npreserve the original spelling. In the C front end, the kind is used\ntransiently.\n\nThis fixes diagnostics such as:\n\nerror: invalid application of 'alignas' to a void type\nerror: invalid application of '_Alignas' to a void type\nerror: invalid application of '_Alignof' to an incomplete type\nerror: invalid application of '__alignof' to an incomplete type\n\n 124601\n PR c++/124601\n\ngcc/c-family/ChangeLog:\n\n\t* c-common.h (alignof_kind): New enum class with enumerators\n\tUNKNOWN, CXX_ALIGNAS, C11_ALIGNAS, C23_ALIGNAS, GNU_ALIGNOF,\n\tGNU_ALIGNOF_ALIAS, CXX_ALIGNOF, C11_ALIGNOF, C23_ALIGNOF.\n\t(GNU_ALIGNOF_KIND_P): New macro. True if kind is GNU_ALIGNOF or\n\tGNU_ALIGNOF_ALIAS.\n\t(STD_ALIGNOF_KIND_P): New macro. True if kind is CXX_ALIGNOF or\n\tCXX_ALIGNAS.\n\t(MIN_ALIGNOF_KIND_P): New macro. True if kind is non-UNKNOWN and\n\tnot a GNU extension.\n\t(c_sizeof_or_alignof_type): Replace bool min_alignof parameter\n\twith alignof_kind kind.\n\t(alignof_kind_spelling): Declare new function.\n\t(classify_alignof_kind): Declare new function.\n\t(c_sizeof): Update macro to pass alignof_kind::UNKNOWN.\n\t(c_alignof): Update macro to pass alignof_kind::GNU_ALIGNOF.\n\t* c-common.cc (alignof_kind_spelling): New function. Returns the\n\tsource-level keyword string for a given alignof_kind enumerator.\n\t(classify_alignof_kind): New function. Maps an identifier node to\n\tits alignof_kind by spelling and language dialect.\n\t(c_sizeof_or_alignof_type): Replace bool min_alignof parameter\n\twith alignof_kind kind. Derive op_name and min_alignof from kind.\n\tConsolidate duplicated pedwarn for function-type alignof into a\n\tsingle dialect-parametric message.\n\ngcc/c/ChangeLog:\n\n\t* c-parser.cc (c_parser_alignas_specifier): Use\n\tclassify_alignof_kind to determine kind from token identifier;\n\tpass kind to c_sizeof_or_alignof_type instead of hardcoded true.\n\t(c_parser_alignof_expression): Replace manual strcmp-based\n\tis_c11_alignof detection with classify_alignof_kind. Pass kind\n\tto c_sizeof_or_alignof_type.\n\ngcc/cp/ChangeLog:\n\n\t* cp-tree.h (ALIGNOF_EXPR_STD_P): Remove macro.\n\t(ALIGNOF_EXPR_KIND): New macro. Reads alignof_kind from\n\tTREE_LANG_FLAG_3/2/1/0 of an ALIGNOF_EXPR node.\n\t(SET_ALIGNOF_EXPR_KIND): New macro. Stores alignof_kind into\n\tTREE_LANG_FLAG_3/2/1/0 of an ALIGNOF_EXPR node.\n\t(TREE_LANG_FLAG_0/1/2/3 comment blocks): Update annotation for\n\tALIGNOF_EXPR to reference ALIGNOF_EXPR_KIND.\n\t(cxx_sizeof_or_alignof_expr): Replace bool std_alignof parameter\n\twith alignof_kind kind.\n\t(cxx_sizeof_or_alignof_type): Replace bool std_alignof parameter\n\twith alignof_kind kind.\n\t(cxx_sizeof): Update macro to pass alignof_kind::UNKNOWN.\n\t* cxx-pretty-print.cc (cxx_pretty_printer::unary_expression):\n\tReplace ALIGNOF_EXPR_STD_P check with\n\talignof_kind_spelling(ALIGNOF_EXPR_KIND(t)) for correct keyword\n\tprinting.\n\t* decl.cc (fold_sizeof_expr): Update all\n\tcxx_sizeof_or_alignof_type and cxx_sizeof_or_alignof_expr calls\n\tto pass alignof_kind::UNKNOWN for SIZEOF_EXPR.\n\t* error.cc (dump_expr): Replace ALIGNOF_EXPR_STD_P check with\n\talignof_kind_spelling(ALIGNOF_EXPR_KIND(t)).\n\t* mangle.cc (write_expression): Replace ALIGNOF_EXPR_STD_P check\n\twith GNU_ALIGNOF_KIND_P(ALIGNOF_EXPR_KIND(expr)) for ABI mangling\n\tguard.\n\t* parser.cc (cp_parser_unary_expression): Replace std_alignof\n\tbool with alignof_kind computed via classify_alignof_kind. Pass\n\tkind to cxx_sizeof_or_alignof_type and\n\tcxx_sizeof_or_alignof_expr. Update pedwarn guard to check for\n\talignof_kind::CXX_ALIGNOF specifically.\n\t* pt.cc (tsubst_expr): Replace std_alignof bool derivation via\n\tALIGNOF_EXPR_STD_P with ALIGNOF_EXPR_KIND. Pass kind to\n\tcxx_sizeof_or_alignof_type and cxx_sizeof_or_alignof_expr. Pass\n\talignof_kind::UNKNOWN for pack-expansion SIZEOF_EXPR paths.\n\t* reflect.cc (eval_size_of): Pass alignof_kind::UNKNOWN to\n\tc_sizeof_or_alignof_type.\n\t(eval_alignment_of): Pass alignof_kind::CXX_ALIGNOF to\n\tc_sizeof_or_alignof_type.\n\t(eval_bit_size_of): Pass alignof_kind::UNKNOWN to\n\tc_sizeof_or_alignof_type.\n\t(eval_data_member_spec): Pass alignof_kind::CXX_ALIGNOF to\n\tcxx_sizeof_or_alignof_type.\n\t* tree.cc (cp_tree_equal): Replace ALIGNOF_EXPR_STD_P comparison\n\twith ALIGNOF_EXPR_KIND comparison.\n\t* typeck.cc (cxx_sizeof_or_alignof_type): Replace bool std_alignof\n\tparameter with alignof_kind kind. Use STD_ALIGNOF_KIND_P and\n\talignof_kind_spelling for void-type diagnostic. Use\n\tSET_ALIGNOF_EXPR_KIND to annotate newly built ALIGNOF_EXPR nodes.\n\t(cxx_sizeof_nowarn): Pass alignof_kind::UNKNOWN.\n\t(cxx_sizeof_expr): Pass alignof_kind::UNKNOWN.\n\t(cxx_alignof_expr): Replace bool std_alignof parameter with\n\talignof_kind kind. Use SET_ALIGNOF_EXPR_KIND.\n\t(cxx_sizeof_or_alignof_expr): Replace bool std_alignof parameter\n\twith alignof_kind kind; thread through to cxx_alignof_expr.\n\t(cxx_alignas_expr): Pass alignof_kind::CXX_ALIGNAS.\n\ngcc/objc/ChangeLog:\n\n\t* objc-act.cc (objc_synthesize_getter): Pass\n\talignof_kind::UNKNOWN instead of false for min_alignof in\n\tc_sizeof_or_alignof_type call.\n\t(objc_synthesize_setter): Likewise.\n\nlibcc1/ChangeLog:\n\n\t* libcp1plugin.cc (plugin_build_unary_expr): Pass\n\talignof_kind::CXX_ALIGNOF to cxx_sizeof_or_alignof_expr for\n\tALIGNOF_EXPR case.\n\t(plugin_build_unary_type_expr): Pass alignof_kind::CXX_ALIGNOF to\n\tcxx_sizeof_or_alignof_type.\n\ngcc/testsuite/ChangeLog:\n\n\t* g++.dg/cpp0x/alignas25.C: New test. Verify that alignas on a\n\tvoid type reports 'alignas' not 'alignof' in diagnostics.\n\t* g++.dg/cpp0x/alignof9.C: New test. Verify that __alignof on a\n\tvoid type reports '__alignof' in diagnostics.\n\t* gcc.dg/c11-align-10.c: New test. Verify correct keyword\n\tspellings (_Alignas, _Alignof) in C11 alignment diagnostics.\n\t* gcc.dg/c23-align-2.c: New test. Verify correct keyword\n\tspellings (alignas, alignof) in C23 alignment diagnostics.\n\nSigned-off-by: yronglin <yronglin777@gmail.com>\n---\n gcc/c-family/c-common.cc | 101 +++++++++++++++++++++----\n gcc/c-family/c-common.h | 46 ++++++++++-\n gcc/c/c-parser.cc | 44 +++++------\n gcc/cp/cp-tree.h | 65 ++++++++++++++--\n gcc/cp/cxx-pretty-print.cc | 4 +-\n gcc/cp/decl.cc | 12 ++-\n gcc/cp/error.cc | 5 +-\n gcc/cp/mangle.cc | 2 +-\n gcc/cp/parser.cc | 8 +-\n gcc/cp/pt.cc | 24 +++---\n gcc/cp/reflect.cc | 13 ++--\n gcc/cp/tree.cc | 2 +-\n gcc/cp/typeck.cc | 50 ++++++------\n gcc/objc/objc-act.cc | 4 +-\n gcc/testsuite/g++.dg/cpp0x/alignas25.C | 15 ++++\n gcc/testsuite/g++.dg/cpp0x/alignof9.C | 9 +++\n gcc/testsuite/gcc.dg/c11-align-10.c | 15 ++++\n gcc/testsuite/gcc.dg/c23-align-2.c | 15 ++++\n libcc1/libcp1plugin.cc | 8 +-\n 19 files changed, 328 insertions(+), 114 deletions(-)\n create mode 100644 gcc/testsuite/g++.dg/cpp0x/alignas25.C\n create mode 100644 gcc/testsuite/g++.dg/cpp0x/alignof9.C\n create mode 100644 gcc/testsuite/gcc.dg/c11-align-10.c\n create mode 100644 gcc/testsuite/gcc.dg/c23-align-2.c", "diff": "diff --git a/gcc/c-family/c-common.cc b/gcc/c-family/c-common.cc\nindex 5acb221d31f..78e4bb0a7da 100644\n--- a/gcc/c-family/c-common.cc\n+++ b/gcc/c-family/c-common.cc\n@@ -3983,7 +3983,81 @@ c_common_get_alias_set (tree t)\n \n return -1;\n }\n-\f\n+\n+/* Return the canonical spelling string for a given alignof/alignas kind.\n+ This maps internal enum values (alignof_kind) to the corresponding\n+ source-level keyword or builtin spelling used in different language\n+ standards and dialects.\n+\n+ Specifically:\n+ - C++11/C23 'alignas' and C++/C23 'alignof'\n+ - C11 '_Alignas' and '_Alignof'\n+ - GNU extensions '__alignof__' and '__alignof'\n+\n+ The function assumes that KIND is a valid enumerator; passing\n+ alignof_kind::UNKNOWN is considered unreachable and will trigger\n+ gcc_unreachable (). */\n+const char *\n+alignof_kind_spelling (alignof_kind kind)\n+{\n+ switch (kind)\n+ {\n+ case alignof_kind::CXX_ALIGNAS:\n+ case alignof_kind::C23_ALIGNAS:\n+ return \"alignas\";\n+ case alignof_kind::C11_ALIGNAS:\n+ return \"_Alignas\";\n+ case alignof_kind::GNU_ALIGNOF:\n+ return \"__alignof__\";\n+ case alignof_kind::GNU_ALIGNOF_ALIAS:\n+ return \"__alignof\";\n+ case alignof_kind::CXX_ALIGNOF:\n+ case alignof_kind::C23_ALIGNOF:\n+ return \"alignof\";\n+ case alignof_kind::C11_ALIGNOF:\n+ return \"_Alignof\";\n+ case alignof_kind::UNKNOWN:\n+ gcc_unreachable ();\n+ }\n+ return \"\";\n+}\n+\n+/* Classify an identifier node as a specific alignof/alignas kind.\n+\n+ Given an identifier tree node ID, this function determines which\n+ alignment-related keyword or builtin it corresponds to and returns\n+ the appropriate alignof_kind enumerator.\n+\n+ The classification is based on both the identifier spelling and the\n+ active language dialect:\n+ - \"alignof\"/\"alignas\" are mapped to either C++ or C23 variants\n+ depending on whether the current dialect is C++.\n+ - \"_Alignof\"/\"_Alignas\" correspond to the C11 keywords.\n+ - \"__alignof__\" and \"__alignof\" are GNU extensions (with the latter\n+ being a legacy alias).\n+\n+ If the identifier does not match any known alignment-related spelling,\n+ alignof_kind::UNKNOWN is returned. */\n+alignof_kind\n+classify_alignof_kind (const_tree id)\n+{\n+ if (id_equal (id, \"alignof\"))\n+ return c_dialect_cxx () ? alignof_kind::CXX_ALIGNOF\n+\t\t\t : alignof_kind::C23_ALIGNOF;\n+ if (id_equal (id, \"alignas\"))\n+ return c_dialect_cxx () ? alignof_kind::CXX_ALIGNAS\n+\t\t\t : alignof_kind::C23_ALIGNAS;\n+ if (id_equal (id, \"__alignof__\"))\n+ return alignof_kind::GNU_ALIGNOF;\n+ if (id_equal (id, \"__alignof\"))\n+ return alignof_kind::GNU_ALIGNOF_ALIAS;\n+ if (id_equal (id, \"_Alignof\"))\n+ return alignof_kind::C11_ALIGNOF;\n+ if (id_equal (id, \"_Alignas\"))\n+ return alignof_kind::C11_ALIGNAS;\n+ return alignof_kind::UNKNOWN;\n+}\n+\n /* Compute the value of 'sizeof (TYPE)' or '__alignof__ (TYPE)', where\n the IS_SIZEOF parameter indicates which operator is being applied.\n The COMPLAIN flag controls whether we should diagnose possibly\n@@ -3993,15 +4067,18 @@ c_common_get_alias_set (tree t)\n alignment for that type. */\n \n tree\n-c_sizeof_or_alignof_type (location_t loc,\n-\t\t\t tree type, bool is_sizeof, bool min_alignof,\n-\t\t\t int complain)\n+c_sizeof_or_alignof_type (location_t loc, tree type, bool is_sizeof,\n+\t\t\t alignof_kind kind, int complain)\n {\n- const char *op_name;\n+ // If the op is ALIGNOF_EXPR, kind must not be alignof_kind::UNKNOWN.\n+ // If the op is SIZEOF_EXPR, kind must be alignof_kind::UNKNOWN.\n+ gcc_assert (!is_sizeof || kind == alignof_kind::UNKNOWN);\n+ gcc_assert (is_sizeof || kind != alignof_kind::UNKNOWN);\n+\n tree value = NULL;\n enum tree_code type_code = TREE_CODE (type);\n-\n- op_name = is_sizeof ? \"sizeof\" : \"__alignof__\";\n+ const char *op_name = is_sizeof ? \"sizeof\" : alignof_kind_spelling (kind);\n+ bool min_alignof = MIN_ALIGNOF_KIND_P (kind);\n \n if (type_code == FUNCTION_TYPE)\n {\n@@ -4018,12 +4095,10 @@ c_sizeof_or_alignof_type (location_t loc,\n \t{\n \t if (complain)\n \t {\n-\t if (c_dialect_cxx ())\n-\t\tpedwarn (loc, OPT_Wpedantic, \"ISO C++ does not permit \"\n-\t\t\t \"%<alignof%> applied to a function type\");\n-\t else\n-\t\tpedwarn (loc, OPT_Wpedantic, \"ISO C does not permit \"\n-\t\t\t \"%<_Alignof%> applied to a function type\");\n+\t pedwarn (loc, OPT_Wpedantic,\n+\t\t \"ISO %s does not permit \"\n+\t\t \"%qs applied to a function type\",\n+\t\t c_dialect_cxx () ? \"C++\" : \"C\", op_name);\n \t }\n \t value = size_int (FUNCTION_BOUNDARY / BITS_PER_UNIT);\n \t}\ndiff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h\nindex 89517e2a80c..404f455f0da 100644\n--- a/gcc/c-family/c-common.h\n+++ b/gcc/c-family/c-common.h\n@@ -756,6 +756,41 @@ enum cxx_dialect {\n /* The C++ dialect being used. C++20 is the default. */\n extern enum cxx_dialect cxx_dialect;\n \n+enum class alignof_kind\n+{\n+ UNKNOWN = 0,\t\t /* not a sizeof or alignof node. */\n+ CXX_ALIGNAS = 1,\t /* C++11 alignas. */\n+ C11_ALIGNAS = 2,\t /* C11 _Alignas. */\n+ C23_ALIGNAS = 3,\t /* C23 alignas. */\n+ GNU_ALIGNOF = 4,\t /* GNU __alignof__. */\n+ GNU_ALIGNOF_ALIAS = 5, /* GNU __alignof. */\n+ CXX_ALIGNOF = 6,\t /* C++11 alignof. */\n+ C11_ALIGNOF = 7,\t /* C11 _Alignof. */\n+ C23_ALIGNOF = 8,\t /* C23 alignof. */\n+};\n+\n+/* True if KIND is one of the GNU alignment-of extensions:\n+ __alignof__ (GNU_ALIGNOF) or the no-trailing-underscore alias\n+ __alignof (GNU_ALIGNOF_ALIAS). */\n+#define GNU_ALIGNOF_KIND_P(KIND)\t\t\\\n+ ((KIND) == alignof_kind::GNU_ALIGNOF\t\t\\\n+ || (KIND) == alignof_kind::GNU_ALIGNOF_ALIAS)\n+\n+/* True if KIND is one of the standard C++ alignment keywords:\n+ alignof (STD_ALIGNOF) or alignas (STD_ALIGNAS).\n+ Used to select C++ standard semantics as opposed to C11/C23 or\n+ GNU extension behaviour. */\n+#define STD_ALIGNOF_KIND_P(KIND)\t\\\n+ ((KIND) == alignof_kind::CXX_ALIGNOF || (KIND) == alignof_kind::CXX_ALIGNAS)\n+\n+/* True if KIND represents an operator that returns the *minimum*\n+ ABI-required alignment rather than the preferred alignment.\n+ All alignof/alignas variants except the GNU extensions use\n+ minimum alignment; __alignof__ and __alignof return preferred\n+ alignment and therefore do NOT satisfy this predicate. */\n+#define MIN_ALIGNOF_KIND_P(KIND)\t\\\n+ ((KIND) != alignof_kind::UNKNOWN && !GNU_ALIGNOF_KIND_P (KIND))\n+\n /* Maximum template instantiation depth. This limit is rather\n arbitrary, but it exists to limit the time it takes to notice\n excessively recursive template instantiations. */\n@@ -895,7 +930,8 @@ extern tree c_fully_fold (tree, bool, bool *, bool = false);\n extern tree c_wrap_maybe_const (tree, bool);\n extern tree c_common_truthvalue_conversion (location_t, tree);\n extern void c_apply_type_quals_to_decl (int, tree);\n-extern tree c_sizeof_or_alignof_type (location_t, tree, bool, bool, int);\n+extern tree c_sizeof_or_alignof_type (location_t, tree, bool, alignof_kind,\n+\t\t\t\t int);\n extern tree c_alignof_expr (location_t, tree);\n extern tree c_countof_type (location_t, tree);\n extern tree c_maxof_type (location_t, tree);\n@@ -929,12 +965,16 @@ extern bool c_flexible_array_member_type_p (const_tree);\n extern unsigned int c_strict_flex_array_level_of (tree);\n extern bool c_option_is_from_cpp_diagnostics (int);\n extern tree c_hardbool_type_attr_1 (tree, tree *, tree *);\n+extern const char *alignof_kind_spelling (alignof_kind);\n+extern alignof_kind classify_alignof_kind (const_tree id);\n \n /* Used by convert_and_check; in front ends. */\n extern tree convert_init (tree, tree);\n \n-#define c_sizeof(LOC, T) c_sizeof_or_alignof_type (LOC, T, true, false, 1)\n-#define c_alignof(LOC, T) c_sizeof_or_alignof_type (LOC, T, false, false, 1)\n+#define c_sizeof(LOC, T)\t\\\n+ c_sizeof_or_alignof_type (LOC, T, true, alignof_kind::UNKNOWN, 1)\n+#define c_alignof(LOC, T)\t\\\n+ c_sizeof_or_alignof_type (LOC, T, false, alignof_kind::GNU_ALIGNOF, 1)\n \n /* Subroutine of build_binary_op, used for certain operations. */\n extern tree shorten_binary_op (tree result_type, tree op0, tree op1, bool bitwise);\ndiff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc\nindex 0b8b2387109..8bffea60e18 100644\n--- a/gcc/c/c-parser.cc\n+++ b/gcc/c/c-parser.cc\n@@ -4872,14 +4872,16 @@ c_parser_alignas_specifier (c_parser * parser)\n tree ret = error_mark_node;\n location_t loc = c_parser_peek_token (parser)->location;\n gcc_assert (c_parser_next_token_is_keyword (parser, RID_ALIGNAS));\n- tree spelling = c_parser_peek_token (parser)->value;\n+ tree alignas_id = c_parser_peek_token (parser)->value;\n+ alignof_kind kind = classify_alignof_kind (alignas_id);\n+\n c_parser_consume_token (parser);\n if (flag_isoc99)\n- pedwarn_c99 (loc, OPT_Wpedantic,\n-\t\t \"ISO C99 does not support %qE\", spelling);\n+ pedwarn_c99 (loc, OPT_Wpedantic, \"ISO C99 does not support %qE\",\n+\t\t alignas_id);\n else\n- pedwarn_c99 (loc, OPT_Wpedantic,\n-\t\t \"ISO C90 does not support %qE\", spelling);\n+ pedwarn_c99 (loc, OPT_Wpedantic, \"ISO C90 does not support %qE\",\n+\t\t alignas_id);\n matching_parens parens;\n if (!parens.require_open (parser))\n return ret;\n@@ -4888,7 +4890,7 @@ c_parser_alignas_specifier (c_parser * parser)\n struct c_type_name *type = c_parser_type_name (parser);\n if (type != NULL)\n \tret = c_sizeof_or_alignof_type (loc, groktypename (type, NULL, NULL),\n-\t\t\t\t\tfalse, true, 1);\n+\t\t\t\t\tfalse, kind, 1);\n }\n else\n ret = convert_lvalue_to_rvalue (loc,\n@@ -10948,12 +10950,12 @@ c_parser_alignof_expression (c_parser *parser)\n struct c_expr expr;\n location_t start_loc = c_parser_peek_token (parser)->location;\n location_t end_loc;\n- tree alignof_spelling = c_parser_peek_token (parser)->value;\n+ tree alignof_id = c_parser_peek_token (parser)->value;\n gcc_assert (c_parser_next_token_is_keyword (parser, RID_ALIGNOF));\n- bool is_c11_alignof = (strcmp (IDENTIFIER_POINTER (alignof_spelling),\n-\t\t\t\t\"_Alignof\") == 0\n-\t\t\t || strcmp (IDENTIFIER_POINTER (alignof_spelling),\n-\t\t\t\t \"alignof\") == 0);\n+ alignof_kind kind = classify_alignof_kind (alignof_id);\n+ bool is_c11_alignof\n+ = kind == alignof_kind::C11_ALIGNOF || kind == alignof_kind::C23_ALIGNOF;\n+\n /* A diagnostic is not required for the use of this identifier in\n the implementation namespace; only diagnose it for the C11 or C23\n spelling because of existing code using the other spellings. */\n@@ -10961,10 +10963,10 @@ c_parser_alignof_expression (c_parser *parser)\n {\n if (flag_isoc99)\n \tpedwarn_c99 (start_loc, OPT_Wpedantic, \"ISO C99 does not support %qE\",\n-\t\t alignof_spelling);\n+\t\t alignof_id);\n else\n \tpedwarn_c99 (start_loc, OPT_Wpedantic, \"ISO C90 does not support %qE\",\n-\t\t alignof_spelling);\n+\t\t alignof_id);\n }\n c_parser_consume_token (parser);\n c_inhibit_evaluation_warnings++;\n@@ -11004,16 +11006,15 @@ c_parser_alignof_expression (c_parser *parser)\n \t}\n /* alignof ( type-name ). */\n if (scspecs)\n-\terror_at (loc, \"storage class specifier in %qE\", alignof_spelling);\n+\terror_at (loc, \"storage class specifier in %qE\", alignof_id);\n if (type_name->specs->alignas_p)\n \terror_at (type_name->specs->locations[cdw_alignas],\n-\t\t \"alignment specified for type name in %qE\",\n-\t\t alignof_spelling);\n+\t\t \"alignment specified for type name in %qE\", alignof_id);\n c_inhibit_evaluation_warnings--;\n in_alignof--;\n- ret.value = c_sizeof_or_alignof_type (loc, groktypename (type_name,\n-\t\t\t\t\t\t\t NULL, NULL),\n-\t\t\t\t\t false, is_c11_alignof, 1);\n+ ret.value\n+\t= c_sizeof_or_alignof_type (loc, groktypename (type_name, NULL, NULL),\n+\t\t\t\t false, kind, 1);\n ret.original_code = ERROR_MARK;\n ret.original_type = NULL;\n set_c_expr_source_range (&ret, start_loc, end_loc);\n@@ -11030,9 +11031,8 @@ c_parser_alignof_expression (c_parser *parser)\n c_inhibit_evaluation_warnings--;\n in_alignof--;\n if (is_c11_alignof)\n-\tpedwarn (start_loc,\n-\t\t OPT_Wpedantic, \"ISO C does not allow %<%E (expression)%>\",\n-\t\t alignof_spelling);\n+\tpedwarn (start_loc, OPT_Wpedantic,\n+\t\t \"ISO C does not allow %<%E (expression)%>\", alignof_id);\n ret.value = c_alignof_expr (start_loc, expr.value);\n ret.original_code = ERROR_MARK;\n ret.original_type = NULL;\ndiff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h\nindex ea3cb049785..0bb3c665ebe 100644\n--- a/gcc/cp/cp-tree.h\n+++ b/gcc/cp/cp-tree.h\n@@ -449,7 +449,6 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX];\n DECL_NAMESPACE_INLINE_P (in NAMESPACE_DECL)\n SWITCH_STMT_ALL_CASES_P (in SWITCH_STMT)\n REINTERPRET_CAST_P (in NOP_EXPR)\n- ALIGNOF_EXPR_STD_P (in ALIGNOF_EXPR)\n OVL_DEDUP_P (in OVERLOAD)\n INIT_EXPR_NRV_P (in INIT_EXPR)\n ATOMIC_CONSTR_MAP_INSTANTIATED_P (in ATOMIC_CONSTR)\n@@ -461,6 +460,7 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX];\n SPLICE_EXPR_EXPRESSION_P (in SPLICE_EXPR)\n OLD_PARM_DECL_P (in PARM_DECL)\n COMPONENT_REF_SPLICE_P (in COMPONENT_REF)\n+ ALIGNOF_EXPR_KIND (in ALIGNOF_EXPR)\n 1: IDENTIFIER_KIND_BIT_1 (in IDENTIFIER_NODE)\n TI_PENDING_TEMPLATE_FLAG.\n TEMPLATE_PARMS_FOR_INLINE.\n@@ -484,6 +484,7 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX];\n MUST_NOT_THROW_THROW_P (in MUST_NOT_THROW_EXPR)\n LAMBDA_EXPR_CONST_QUAL_P (in LAMBDA_EXPR)\n SPLICE_EXPR_MEMBER_ACCESS_P (in SPLICE_EXPR)\n+ ALIGNOF_EXPR_KIND (in ALIGNOF_EXPR)\n 2: IDENTIFIER_KIND_BIT_2 (in IDENTIFIER_NODE)\n ICS_THIS_FLAG (in _CONV)\n DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (in VAR_DECL)\n@@ -508,6 +509,7 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX];\n MUST_NOT_THROW_CATCH_P (in MUST_NOT_THROW_EXPR)\n MULTIPLE_NAMES_PARM_P (in PARM_DECL)\n SPLICE_EXPR_ADDRESS_P (in SPLICE_EXPR)\n+ ALIGNOF_EXPR_KIND (in ALIGNOF_EXPR)\n 3: IMPLICIT_RVALUE_P (in NON_LVALUE_EXPR or STATIC_CAST_EXPR)\n ICS_BAD_FLAG (in _CONV)\n FN_TRY_BLOCK_P (in TRY_BLOCK)\n@@ -522,6 +524,7 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX];\n TARGET_EXPR_ELIDING_P (in TARGET_EXPR)\n IF_STMT_VACUOUS_INIT_P (IF_STMT)\n TYPENAME_IS_RESOLVING_P (in TYPENAME_TYPE)\n+ ALIGNOF_EXPR_KIND (in ALIGNOF_EXPR)\n 4: IDENTIFIER_MARKED (IDENTIFIER_NODEs)\n TREE_HAS_CONSTRUCTOR (in INDIRECT_REF, SAVE_EXPR, CONSTRUCTOR,\n \t CALL_EXPR, or FIELD_DECL).\n@@ -5966,9 +5969,50 @@ target_expr_needs_replace (tree t)\n #define SIZEOF_EXPR_TYPE_P(NODE) \\\n TREE_LANG_FLAG_0 (SIZEOF_EXPR_CHECK (NODE))\n \n-/* True if the ALIGNOF_EXPR was spelled \"alignof\". */\n-#define ALIGNOF_EXPR_STD_P(NODE) \\\n- TREE_LANG_FLAG_0 (ALIGNOF_EXPR_CHECK (NODE))\n+/* ALIGNOF_EXPR_KIND (NODE)\n+ Read the alignof_kind of an ALIGNOF_EXPR node.\n+\n+ The kind is stored as the raw enumerator value in\n+ TREE_LANG_FLAG_3/2/1/0, where FLAG3 is the most-significant bit:\n+\n+ FLAG3 FLAG2 FLAG1 FLAG0 alignof_kind\n+ 0 0 0 0 UNKNOWN\t\t\t not ALIGNOF_EXPR\n+ 0 0 0 1 STD_ALIGNAS\t\t C++11 alignas\n+ 0 0 1 0 C11_ALIGNAS\t\t _Alignas\n+ 0 0 1 1 C23_ALIGNAS\t\t C23 alignas\n+ 0 1 0 0 GNU_ALIGNOF\t\t __alignof__\n+ 0 1 0 1 GNU_ALIGNOF_ALIAS\t __alignof\n+ 0 1 1 0 STD_ALIGNOF\t\t C++11 alignof\n+ 0 1 1 1 C11_ALIGNOF\t\t _Alignof\n+ 1 0 0 0 C23_ALIGNOF\t\t C23 alignof\n+\n+ All-zero flags (UNKNOWN) is the natural default for a freshly\n+ allocated tree node. Callers that build an ALIGNOF_EXPR must\n+ immediately follow with SET_ALIGNOF_EXPR_KIND. */\n+#define ALIGNOF_EXPR_KIND(NODE)\t\t\t\t\t\\\n+ static_cast<alignof_kind> (\t\t\t\t\t\\\n+ (TREE_LANG_FLAG_3 (ALIGNOF_EXPR_CHECK (NODE)) << 3)\t\t\\\n+ | (TREE_LANG_FLAG_2 (ALIGNOF_EXPR_CHECK (NODE)) << 2)\t\\\n+ | (TREE_LANG_FLAG_1 (ALIGNOF_EXPR_CHECK (NODE)) << 1)\t\\\n+ | TREE_LANG_FLAG_0 (ALIGNOF_EXPR_CHECK (NODE)))\n+\n+/* SET_ALIGNOF_EXPR_KIND (NODE, KIND)\n+ Store KIND into the ALIGNOF_EXPR node NODE.\n+ KIND must not be alignof_kind::UNKNOWN unless intentionally\n+ clearing the annotation; passing UNKNOWN resets all four flag bits.\n+ Must be called once immediately after each ALIGNOF_EXPR node is\n+ created, before the node is shared or placed into a larger\n+ expression. */\n+#define SET_ALIGNOF_EXPR_KIND(NODE, KIND)\t\t\t\t\\\n+ do\t\t\t\t\t\t\t\t\t\\\n+ {\t\t\t\t\t\t\t\t\t\\\n+ unsigned _b = static_cast<unsigned> (KIND);\t\t\t\\\n+ TREE_LANG_FLAG_0 (ALIGNOF_EXPR_CHECK (NODE)) = _b & 1u;\t\t\\\n+ TREE_LANG_FLAG_1 (ALIGNOF_EXPR_CHECK (NODE)) = (_b >> 1) & 1u;\t\\\n+ TREE_LANG_FLAG_2 (ALIGNOF_EXPR_CHECK (NODE)) = (_b >> 2) & 1u;\t\\\n+ TREE_LANG_FLAG_3 (ALIGNOF_EXPR_CHECK (NODE)) = (_b >> 3) & 1u;\t\\\n+ }\t\t\t\t\t\t\t\t\t\\\n+ while (0)\n \n /* OMP_DEPOBJ accessors. These give access to the depobj expression of the\n #pragma omp depobj directive and the clauses, respectively. If\n@@ -5985,7 +6029,7 @@ enum tag_types {\n union_type, /* \"union\" types. */\n enum_type, /* \"enum\" types. */\n typename_type, /* \"typename\" types. */\n- scope_type\t /* namespace or tagged type name followed by :: */\n+ scope_type /* namespace or tagged type name followed by :: */\n };\n \n /* Return the tag type of the given TYPENAME_TYPE. */\n@@ -8810,9 +8854,12 @@ extern int comp_cv_qualification\t\t(const_tree, const_tree);\n extern int comp_cv_qualification\t\t(int, int);\n extern int comp_cv_qual_signature\t\t(tree, tree);\n extern tree cxx_sizeof_or_alignof_expr\t\t(location_t, tree,\n-\t\t\t\t\t\t enum tree_code, bool, bool);\n+\t\t\t\t\t\t enum tree_code, alignof_kind,\n+\t\t\t\t\t\t bool);\n extern tree cxx_sizeof_or_alignof_type\t\t(location_t, tree,\n-\t\t\t\t\t\t enum tree_code, bool, bool);\n+\t\t\t\t\t\t enum tree_code,\n+\t\t\t\t\t\t alignof_kind,\n+\t\t\t\t\t\t bool);\n extern tree cxx_alignas_expr (tree);\n extern tree cxx_sizeof_nowarn (tree);\n extern tree is_bitfield_expr_with_lowered_type (const_tree);\n@@ -8934,7 +8981,9 @@ extern tree build_x_vec_perm_expr (location_t,\n extern tree build_x_shufflevector (location_t,\n \t\t\t\t\t\t vec<tree, va_gc> *,\n \t\t\t\t\t\t tsubst_flags_t);\n-#define cxx_sizeof(T) cxx_sizeof_or_alignof_type (input_location, T, SIZEOF_EXPR, false, true)\n+#define cxx_sizeof(T)\t\t\t\t\t\t\t\\\n+ cxx_sizeof_or_alignof_type (input_location, T, SIZEOF_EXPR,\t\t\\\n+\t\t\t alignof_kind::UNKNOWN, true)\n extern tree build_simple_component_ref\t\t(tree, tree);\n extern tree build_ptrmemfunc_access_expr\t(tree, tree);\n extern tree build_address\t\t\t(tree);\ndiff --git a/gcc/cp/cxx-pretty-print.cc b/gcc/cp/cxx-pretty-print.cc\nindex db13a83ff90..c104e786066 100644\n--- a/gcc/cp/cxx-pretty-print.cc\n+++ b/gcc/cp/cxx-pretty-print.cc\n@@ -857,10 +857,8 @@ cxx_pretty_printer::unary_expression (tree t)\n case ALIGNOF_EXPR:\n if (code == SIZEOF_EXPR)\n \tpp_cxx_ws_string (this, \"sizeof\");\n- else if (ALIGNOF_EXPR_STD_P (t))\n-\tpp_cxx_ws_string (this, \"alignof\");\n else\n-\tpp_cxx_ws_string (this, \"__alignof__\");\n+\tpp_cxx_ws_string (this, alignof_kind_spelling (ALIGNOF_EXPR_KIND (t)));\n pp_cxx_whitespace (this);\n if (TREE_CODE (t) == SIZEOF_EXPR && SIZEOF_EXPR_TYPE_P (t))\n \t{\ndiff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc\nindex 74099c34348..fea8ea43956 100644\n--- a/gcc/cp/decl.cc\n+++ b/gcc/cp/decl.cc\n@@ -13117,15 +13117,13 @@ fold_sizeof_expr (tree t)\n if (SIZEOF_EXPR_TYPE_P (t))\n r = cxx_sizeof_or_alignof_type (EXPR_LOCATION (t),\n \t\t\t\t TREE_TYPE (TREE_OPERAND (t, 0)),\n-\t\t\t\t SIZEOF_EXPR, false, false);\n+\t\t\t\t SIZEOF_EXPR, alignof_kind::UNKNOWN, false);\n else if (TYPE_P (TREE_OPERAND (t, 0)))\n- r = cxx_sizeof_or_alignof_type (EXPR_LOCATION (t),\n-\t\t\t\t TREE_OPERAND (t, 0), SIZEOF_EXPR,\n-\t\t\t\t false, false);\n+ r = cxx_sizeof_or_alignof_type (EXPR_LOCATION (t), TREE_OPERAND (t, 0),\n+\t\t\t\t SIZEOF_EXPR, alignof_kind::UNKNOWN, false);\n else\n- r = cxx_sizeof_or_alignof_expr (EXPR_LOCATION (t),\n-\t\t\t\t TREE_OPERAND (t, 0), SIZEOF_EXPR,\n-\t\t\t\t false, false);\n+ r = cxx_sizeof_or_alignof_expr (EXPR_LOCATION (t), TREE_OPERAND (t, 0),\n+\t\t\t\t SIZEOF_EXPR, alignof_kind::UNKNOWN, false);\n if (r == error_mark_node)\n r = size_one_node;\n r = cp_fold_convert (size_type_node, r);\ndiff --git a/gcc/cp/error.cc b/gcc/cp/error.cc\nindex b3e66924e31..d83cc794016 100644\n--- a/gcc/cp/error.cc\n+++ b/gcc/cp/error.cc\n@@ -3043,10 +3043,9 @@ dump_expr (cxx_pretty_printer *pp, tree t, int flags)\n case ALIGNOF_EXPR:\n if (TREE_CODE (t) == SIZEOF_EXPR)\n \tpp_cxx_ws_string (pp, \"sizeof\");\n- else if (ALIGNOF_EXPR_STD_P (t))\n-\tpp_cxx_ws_string (pp, \"alignof\");\n else\n-\tpp_cxx_ws_string (pp, \"__alignof__\");\n+\tpp_cxx_ws_string (pp, alignof_kind_spelling (ALIGNOF_EXPR_KIND (t)));\n+\n op = TREE_OPERAND (t, 0);\n if (PACK_EXPANSION_P (op))\n \t{\ndiff --git a/gcc/cp/mangle.cc b/gcc/cp/mangle.cc\nindex 3b8b9ed9d77..c02922fa732 100644\n--- a/gcc/cp/mangle.cc\n+++ b/gcc/cp/mangle.cc\n@@ -3604,7 +3604,7 @@ write_expression (tree expr)\n }\n else if (TREE_CODE (expr) == ALIGNOF_EXPR)\n {\n- if (!ALIGNOF_EXPR_STD_P (expr))\n+ if (GNU_ALIGNOF_KIND_P (ALIGNOF_EXPR_KIND (expr)))\n \t{\n \t if (abi_check (16))\n \t {\ndiff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc\nindex 8d88dc9c312..7cdbbdcaa1d 100644\n--- a/gcc/cp/parser.cc\n+++ b/gcc/cp/parser.cc\n@@ -10263,7 +10263,7 @@ cp_parser_unary_expression (cp_parser *parser, cp_id_kind * pidk,\n \t location_t start_loc = token->location;\n \n \t op = keyword == RID_ALIGNOF ? ALIGNOF_EXPR : SIZEOF_EXPR;\n-\t bool std_alignof = id_equal (token->u.value, \"alignof\");\n+\t alignof_kind alignof_kind = classify_alignof_kind (token->u.value);\n \n \t /* Consume the token. */\n \t cp_lexer_consume_token (parser->lexer);\n@@ -10280,19 +10280,19 @@ cp_parser_unary_expression (cp_parser *parser, cp_id_kind * pidk,\n \n \t if (TYPE_P (operand))\n \t ret = cxx_sizeof_or_alignof_type (compound_loc, operand, op,\n-\t\t\t\t\t\tstd_alignof, true);\n+\t\t\t\t\t\talignof_kind, true);\n \t else\n \t {\n \t\t/* ISO C++ defines alignof only with types, not with\n \t\t expressions. So pedwarn if alignof is used with a non-\n \t\t type expression. However, __alignof__ is ok. */\n-\t\tif (std_alignof)\n+\t\tif (alignof_kind == alignof_kind::CXX_ALIGNOF)\n \t\t pedwarn (token->location, OPT_Wpedantic,\n \t\t\t \"ISO C++ does not allow %<alignof%> \"\n \t\t\t \"with a non-type\");\n \n \t\tret = cxx_sizeof_or_alignof_expr (compound_loc, operand, op,\n-\t\t\t\t\t\t std_alignof, true);\n+\t\t\t\t\t\t alignof_kind, true);\n \t }\n \t /* For SIZEOF_EXPR, just issue diagnostics, but keep\n \t SIZEOF_EXPR with the original operand. */\ndiff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc\nindex 020a70c1112..0440adb244e 100644\n--- a/gcc/cp/pt.cc\n+++ b/gcc/cp/pt.cc\n@@ -21781,12 +21781,12 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)\n \t if (TYPE_P (expanded))\n \t\tRETURN (cxx_sizeof_or_alignof_type (input_location,\n \t\t\t\t\t\t expanded, SIZEOF_EXPR,\n-\t\t\t\t\t\t false,\n+\t\t\t\t\t\t alignof_kind::UNKNOWN,\n \t\t\t\t\t\t complain & tf_error));\n \t else\n \t\tRETURN (cxx_sizeof_or_alignof_expr (input_location,\n \t\t\t\t\t\t expanded, SIZEOF_EXPR,\n-\t\t\t\t\t\t false,\n+\t\t\t\t\t\t alignof_kind::UNKNOWN,\n \t\t\t\t\t\t complain & tf_error));\n \t }\n \t else\n@@ -21801,9 +21801,11 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)\n \top1 = TREE_OPERAND (t, 0);\n \tif (TREE_CODE (t) == SIZEOF_EXPR && SIZEOF_EXPR_TYPE_P (t))\n \t op1 = TREE_TYPE (op1);\n-\tbool std_alignof = (TREE_CODE (t) == ALIGNOF_EXPR\n-\t\t\t && ALIGNOF_EXPR_STD_P (t));\n- if (!args)\n+\talignof_kind kind\n+\t = (TREE_CODE (t) == SIZEOF_EXPR ? alignof_kind::UNKNOWN\n+\t\t\t\t\t : ALIGNOF_EXPR_KIND (t));\n+\n+\tif (!args)\n \t {\n \t /* When there are no ARGS, we are trying to evaluate a\n \t non-dependent expression from the parser. Trying to do\n@@ -21822,14 +21824,12 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)\n \t --cp_unevaluated_operand;\n \t --c_inhibit_evaluation_warnings;\n \t }\n- if (TYPE_P (op1))\n-\t r = cxx_sizeof_or_alignof_type (input_location,\n-\t\t\t\t\t op1, TREE_CODE (t), std_alignof,\n-\t\t\t\t\t complain & tf_error);\n+\tif (TYPE_P (op1))\n+\t r = cxx_sizeof_or_alignof_type (input_location, op1, TREE_CODE (t),\n+\t\t\t\t\t kind, complain & tf_error);\n \telse\n-\t r = cxx_sizeof_or_alignof_expr (input_location,\n-\t\t\t\t\t op1, TREE_CODE (t), std_alignof,\n-\t\t\t\t\t complain & tf_error);\n+\t r = cxx_sizeof_or_alignof_expr (input_location, op1, TREE_CODE (t),\n+\t\t\t\t\t kind, complain & tf_error);\n \tif (TREE_CODE (t) == SIZEOF_EXPR && r != error_mark_node)\n \t {\n \t if (TREE_CODE (r) != SIZEOF_EXPR || TYPE_P (op1))\ndiff --git a/gcc/cp/reflect.cc b/gcc/cp/reflect.cc\nindex 0b1d3a36f37..9e387d5a22e 100644\n--- a/gcc/cp/reflect.cc\n+++ b/gcc/cp/reflect.cc\n@@ -3210,7 +3210,8 @@ eval_size_of (location_t loc, const constexpr_ctx *ctx, tree r,\n if (!complete_type_or_maybe_complain (type, NULL_TREE, tf_none)\n /* No special casing of references needed, c_sizeof_or_alignof_type\n \t returns the same size for POINTER_TYPE and REFERENCE_TYPE. */\n- || ((ret = c_sizeof_or_alignof_type (loc, type, true, false, 0))\n+ || ((ret = c_sizeof_or_alignof_type (loc, type, true,\n+\t\t\t\t\t alignof_kind::UNKNOWN, 0))\n \t == error_mark_node))\n return throw_exception (loc, ctx,\n \t\t\t \"reflection with incomplete type in size_of\",\n@@ -3291,7 +3292,8 @@ eval_alignment_of (location_t loc, const constexpr_ctx *ctx, tree r,\n if (!complete_type_or_maybe_complain (type, NULL_TREE, tf_none)\n /* No special casing of references needed, c_sizeof_or_alignof_type\n \t returns the same alignment for POINTER_TYPE and REFERENCE_TYPE. */\n- || ((ret = c_sizeof_or_alignof_type (loc, type, false, true, 0))\n+ || ((ret = c_sizeof_or_alignof_type (loc, type, false,\n+\t\t\t\t\t alignof_kind::CXX_ALIGNOF, 0))\n \t == error_mark_node))\n return throw_exception (loc, ctx,\n \t\t\t \"reflection with incomplete type in alignment_of\",\n@@ -3350,7 +3352,8 @@ eval_bit_size_of (location_t loc, const constexpr_ctx *ctx, tree r,\n if (!complete_type_or_maybe_complain (type, NULL_TREE, tf_none)\n /* No special casing of references needed, c_sizeof_or_alignof_type\n \t returns the same size for POINTER_TYPE and REFERENCE_TYPE. */\n- || ((ret = c_sizeof_or_alignof_type (loc, type, true, false, 0))\n+ || ((ret = c_sizeof_or_alignof_type (loc, type, true,\n+\t\t\t\t\t alignof_kind::UNKNOWN, 0))\n \t == error_mark_node))\n return throw_exception (loc, ctx,\n \t\t\t \"reflection with incomplete type in bit_size_of\",\n@@ -5866,8 +5869,8 @@ eval_data_member_spec (location_t loc, const constexpr_ctx *ctx,\n if (tree_int_cst_sgn (args[2]) < 0)\n \treturn throw_exception (loc, ctx, \"alignment is negative\",\n \t\t\t\tfun, non_constant_p, jump_target);\n- tree al = cxx_sizeof_or_alignof_type (loc, type, ALIGNOF_EXPR, true,\n-\t\t\t\t\t tf_none);\n+ tree al = cxx_sizeof_or_alignof_type (loc, type, ALIGNOF_EXPR,\n+\t\t\t\t\t alignof_kind::CXX_ALIGNOF, tf_none);\n if (TREE_CODE (al) == INTEGER_CST\n \t && wi::to_widest (al) > wi::to_widest (args[2]))\n \treturn throw_exception (loc, ctx,\ndiff --git a/gcc/cp/tree.cc b/gcc/cp/tree.cc\nindex 7296f2b5c0d..891de24fad8 100644\n--- a/gcc/cp/tree.cc\n+++ b/gcc/cp/tree.cc\n@@ -4383,7 +4383,7 @@ cp_tree_equal (tree t1, tree t2)\n \t if (SIZEOF_EXPR_TYPE_P (t2))\n \t o2 = TREE_TYPE (o2);\n \t }\n-\telse if (ALIGNOF_EXPR_STD_P (t1) != ALIGNOF_EXPR_STD_P (t2))\n+\telse if (ALIGNOF_EXPR_KIND (t1) != ALIGNOF_EXPR_KIND (t2))\n \t return false;\n \n \tif (TREE_CODE (o1) != TREE_CODE (o2))\ndiff --git a/gcc/cp/typeck.cc b/gcc/cp/typeck.cc\nindex 79eb3b5ba28..c90e82e2edc 100644\n--- a/gcc/cp/typeck.cc\n+++ b/gcc/cp/typeck.cc\n@@ -2168,7 +2168,7 @@ compparms (const_tree parms1, const_tree parms2)\n \n tree\n cxx_sizeof_or_alignof_type (location_t loc, tree type, enum tree_code op,\n-\t\t\t bool std_alignof, bool complain)\n+\t\t\t alignof_kind kind, bool complain)\n {\n gcc_assert (op == SIZEOF_EXPR || op == ALIGNOF_EXPR);\n if (type == error_mark_node)\n@@ -2187,12 +2187,14 @@ cxx_sizeof_or_alignof_type (location_t loc, tree type, enum tree_code op,\n else\n \treturn error_mark_node;\n }\n- else if (VOID_TYPE_P (type) && std_alignof)\n+ else if (VOID_TYPE_P (type) && STD_ALIGNOF_KIND_P (kind))\n {\n if (complain)\n-\terror_at (loc, \"invalid application of %qs to a void type\",\n-\t\t OVL_OP_INFO (false, op)->name);\n- return error_mark_node;\n+\t{\n+\t error_at (loc, \"invalid application of %qs to a void type\",\n+\t\t alignof_kind_spelling (kind));\n+\t return error_mark_node;\n+\t}\n }\n \n bool dependent_p = dependent_type_p (type);\n@@ -2218,15 +2220,14 @@ cxx_sizeof_or_alignof_type (location_t loc, tree type, enum tree_code op,\n {\n tree value = build_min (op, size_type_node, type);\n TREE_READONLY (value) = 1;\n- if (op == ALIGNOF_EXPR && std_alignof)\n-\tALIGNOF_EXPR_STD_P (value) = true;\n+ if (op == ALIGNOF_EXPR)\n+\tSET_ALIGNOF_EXPR_KIND (value, kind);\n SET_EXPR_LOCATION (value, loc);\n return value;\n }\n \n- return c_sizeof_or_alignof_type (loc, complete_type (type),\n-\t\t\t\t op == SIZEOF_EXPR, std_alignof,\n-\t\t\t\t complain & (tf_warning_or_error));\n+ return c_sizeof_or_alignof_type (loc, complete_type (type), op == SIZEOF_EXPR,\n+\t\t\t\t kind, complain & (tf_warning_or_error));\n }\n \n /* Return the size of the type, without producing any warnings for\n@@ -2243,8 +2244,8 @@ cxx_sizeof_nowarn (tree type)\n else if (!COMPLETE_TYPE_P (type))\n return size_zero_node;\n else\n- return cxx_sizeof_or_alignof_type (input_location, type,\n-\t\t\t\t SIZEOF_EXPR, false, false);\n+ return cxx_sizeof_or_alignof_type (input_location, type, SIZEOF_EXPR,\n+\t\t\t\t alignof_kind::UNKNOWN, false);\n }\n \n /* Process a sizeof expression where the operand is an expression. */\n@@ -2310,7 +2311,7 @@ cxx_sizeof_expr (location_t loc, tree e, tsubst_flags_t complain)\n else\n e = TREE_TYPE (e);\n \n- return cxx_sizeof_or_alignof_type (loc, e, SIZEOF_EXPR, false,\n+ return cxx_sizeof_or_alignof_type (loc, e, SIZEOF_EXPR, alignof_kind::UNKNOWN,\n \t\t\t\t complain & tf_error);\n }\n \n@@ -2321,7 +2322,7 @@ cxx_sizeof_expr (location_t loc, tree e, tsubst_flags_t complain)\n like in cxx_sizeof_or_alignof_type. */\n \n static tree\n-cxx_alignof_expr (location_t loc, tree e, bool std_alignof,\n+cxx_alignof_expr (location_t loc, tree e, alignof_kind kind,\n \t\t tsubst_flags_t complain)\n {\n tree t;\n@@ -2335,8 +2336,7 @@ cxx_alignof_expr (location_t loc, tree e, bool std_alignof,\n TREE_SIDE_EFFECTS (e) = 0;\n TREE_READONLY (e) = 1;\n SET_EXPR_LOCATION (e, loc);\n- ALIGNOF_EXPR_STD_P (e) = std_alignof;\n-\n+ SET_ALIGNOF_EXPR_KIND (e, kind);\n return e;\n }\n \n@@ -2387,9 +2387,8 @@ cxx_alignof_expr (location_t loc, tree e, bool std_alignof,\n t = size_one_node;\n }\n else\n- return cxx_sizeof_or_alignof_type (loc, TREE_TYPE (e),\n-\t\t\t\t ALIGNOF_EXPR, std_alignof,\n- complain & tf_error);\n+ return cxx_sizeof_or_alignof_type (loc, TREE_TYPE (e), ALIGNOF_EXPR, kind,\n+\t\t\t\t complain & tf_error);\n \n return fold_convert_loc (loc, size_type_node, t);\n }\n@@ -2399,14 +2398,14 @@ cxx_alignof_expr (location_t loc, tree e, bool std_alignof,\n \n tree\n cxx_sizeof_or_alignof_expr (location_t loc, tree e, enum tree_code op,\n-\t\t\t bool std_alignof, bool complain)\n+\t\t\t alignof_kind kind, bool complain)\n {\n gcc_assert (op == SIZEOF_EXPR || op == ALIGNOF_EXPR);\n if (op == SIZEOF_EXPR)\n- return cxx_sizeof_expr (loc, e, complain? tf_warning_or_error : tf_none);\n+ return cxx_sizeof_expr (loc, e, complain ? tf_warning_or_error : tf_none);\n else\n- return cxx_alignof_expr (loc, e, std_alignof,\n-\t\t\t complain? tf_warning_or_error : tf_none);\n+ return cxx_alignof_expr (loc, e, kind,\n+\t\t\t complain ? tf_warning_or_error : tf_none);\n }\n \n /* Build a representation of an expression 'alignas(E).' Return the\n@@ -2430,9 +2429,8 @@ cxx_alignas_expr (tree e)\n \t alignas(type-id), it shall have the same effect as\n \t alignas(alignof(type-id)). */\n \n- return cxx_sizeof_or_alignof_type (input_location,\n-\t\t\t\t e, ALIGNOF_EXPR,\n-\t\t\t\t /*std_alignof=*/true,\n+ return cxx_sizeof_or_alignof_type (input_location, e, ALIGNOF_EXPR,\n+\t\t\t\t alignof_kind::CXX_ALIGNAS,\n \t\t\t\t /*complain=*/true);\n \n /* If we reach this point, it means the alignas expression if of\ndiff --git a/gcc/objc/objc-act.cc b/gcc/objc/objc-act.cc\nindex 0a3c44499a8..ce9f98dc866 100644\n--- a/gcc/objc/objc-act.cc\n+++ b/gcc/objc/objc-act.cc\n@@ -7473,7 +7473,7 @@ objc_synthesize_getter (tree klass, tree class_methods ATTRIBUTE_UNUSED, tree pr\n \t the same type, there is no need to lookup the ivar. */\n \t size_of = c_sizeof_or_alignof_type (location, TREE_TYPE (property),\n \t\t\t\t\t true /* is_sizeof */,\n-\t\t\t\t\t false /* min_alignof */,\n+\t\t\t\t\t alignof_kind::UNKNOWN,\n \t\t\t\t\t false /* complain */);\n \n \t if (PROPERTY_NONATOMIC (property))\n@@ -7675,7 +7675,7 @@ objc_synthesize_setter (tree klass, tree class_methods ATTRIBUTE_UNUSED, tree pr\n \t the same type, there is no need to lookup the ivar. */\n \t size_of = c_sizeof_or_alignof_type (location, TREE_TYPE (property),\n \t\t\t\t\t true /* is_sizeof */,\n-\t\t\t\t\t false /* min_alignof */,\n+\t\t\t\t\t alignof_kind::UNKNOWN,\n \t\t\t\t\t false /* complain */);\n \n \t if (PROPERTY_NONATOMIC (property))\ndiff --git a/gcc/testsuite/g++.dg/cpp0x/alignas25.C b/gcc/testsuite/g++.dg/cpp0x/alignas25.C\nnew file mode 100644\nindex 00000000000..1794a457734\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/cpp0x/alignas25.C\n@@ -0,0 +1,15 @@\n+// PR c++/124601\n+// { dg-do compile { target c++11 } }\n+// { dg-options \"-pedantic\" }\n+\n+template <typename T> class alignas(T) A {}; // { dg-error \"invalid application of 'alignas' to a void type\" }\n+class alignas(void) B {}; // { dg-error \"invalid application of 'alignas' to a void type\" }\n+template <typename... T> class alignas(T...) C {}; // { dg-error \"invalid application of 'alignas' to a void type\" }\n+\n+\n+void f() {\n+ A<void> a;\n+ C<int, void> b;\n+}\n+\n+// { dg-bogus \"'alignof'\" \"\" { target *-*-* } 0 }\ndiff --git a/gcc/testsuite/g++.dg/cpp0x/alignof9.C b/gcc/testsuite/g++.dg/cpp0x/alignof9.C\nnew file mode 100644\nindex 00000000000..c6cc3e17a71\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/cpp0x/alignof9.C\n@@ -0,0 +1,9 @@\n+// PR c++/124601\n+// { dg-do compile { target c++11 } }\n+// { dg-options \"-Wpedantic\" }\n+\n+void\n+foo ()\n+{\n+ __alignof (void); // { dg-warning \"invalid application of '__alignof' to a void type\" }\n+}\n\\ No newline at end of file\ndiff --git a/gcc/testsuite/gcc.dg/c11-align-10.c b/gcc/testsuite/gcc.dg/c11-align-10.c\nnew file mode 100644\nindex 00000000000..b4b377cb9bc\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/c11-align-10.c\n@@ -0,0 +1,15 @@\n+/* Test C11 alignment support. Test the keyword spelling is correct in\n+ * diagnostic. */\n+/* { dg-do compile } */\n+/* { dg-options \"-std=c11 -pedantic-errors\" } */\n+\n+void\n+foo ()\n+{\n+ _Alignas (void) char buf[32];\t\t/* { dg-error \"invalid application of '_Alignas' to a void type\" } */\n+ _Alignof (void);\t\t\t/* { dg-error \"invalid application of '_Alignof' to a void type\" } */\n+ _Alignas (int[]) char buf1[32]; \t/* { dg-error \"invalid application of '_Alignas' to incomplete type\" } */\n+ _Alignas(void(void)) char buf2[16];\t/* { dg-error \"ISO C does not permit '_Alignas' applied to a function type\" } */\n+ _Alignof (int[]);\t\t \t/* { dg-error \"invalid application of '_Alignof' to incomplete type\" } */\n+ _Alignof(void (void));\t \t/* { dg-error \"ISO C does not permit '_Alignof' applied to a function type\" } */\n+}\n\\ No newline at end of file\ndiff --git a/gcc/testsuite/gcc.dg/c23-align-2.c b/gcc/testsuite/gcc.dg/c23-align-2.c\nnew file mode 100644\nindex 00000000000..c5ba902e77e\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/c23-align-2.c\n@@ -0,0 +1,15 @@\n+/* Test C11 alignment support. Test the keyword spelling is correct in\n+ * diagnostic. */\n+/* { dg-do compile } */\n+/* { dg-options \"-std=c23 -pedantic-errors\" } */\n+\n+void\n+foo ()\n+{\n+ alignof(void (void)); \t\t/* { dg-error \"ISO C does not permit 'alignof' applied to a function type\" } */\n+ alignas(void(void)) char buf[16]; \t/* { dg-error \"ISO C does not permit 'alignas' applied to a function type\" } */\n+ alignas (int[]) char buf1[32]; \t/* { dg-error \"invalid application of 'alignas' to incomplete type\" } */\n+ alignof (int[]);\t\t \t/* { dg-error \"invalid application of 'alignof' to incomplete type\" } */\n+ alignas (void) char buf2[32]; \t/* { dg-error \"invalid application of 'alignas' to a void type\" } */\n+ alignof (void);\t\t \t/* { dg-error \"invalid application of 'alignof' to a void type\" } */\n+}\ndiff --git a/libcc1/libcp1plugin.cc b/libcc1/libcp1plugin.cc\nindex e62c6ef9b9b..71fddec768f 100644\n--- a/libcc1/libcp1plugin.cc\n+++ b/libcc1/libcp1plugin.cc\n@@ -2649,8 +2649,8 @@ plugin_build_unary_expr (cc1_plugin::connection *self,\n \n case SIZEOF_EXPR:\n case ALIGNOF_EXPR:\n- result = cxx_sizeof_or_alignof_expr (input_location,\n-\t\t\t\t\t op0, opcode, true, true);\n+ result = cxx_sizeof_or_alignof_expr (input_location, op0, opcode,\n+\t\t\t\t\t alignof_kind::CXX_ALIGNOF, true);\n break;\n \n case DELETE_EXPR:\n@@ -2893,8 +2893,8 @@ plugin_build_unary_type_expr (cc1_plugin::connection *self,\n \n default:\n /* Use the C++11 alignof semantics. */\n- result = cxx_sizeof_or_alignof_type (input_location, type,\n-\t\t\t\t\t opcode, true, true);\n+ result = cxx_sizeof_or_alignof_type (input_location, type, opcode,\n+\t\t\t\t\t alignof_kind::CXX_ALIGNOF, true);\n }\n \n if (template_dependent_p)\n", "prefixes": [ "v3" ] }