From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id B4ZfLNhLe2KIkwUAWB0awg (envelope-from ) for ; Wed, 11 May 2022 01:38:32 -0400 Received: by simark.ca (Postfix, from userid 112) id A17DA1E21F; Wed, 11 May 2022 01:38:32 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, NICE_REPLY_A,RDNS_DYNAMIC autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 69C4B1E01D for ; Wed, 11 May 2022 01:38:31 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1A2DF38425B1 for ; Wed, 11 May 2022 05:38:30 +0000 (GMT) Received: from icp-osb-irony-out3.external.iinet.net.au (icp-osb-irony-out3.external.iinet.net.au [203.59.1.153]) by sourceware.org (Postfix) with ESMTP id BB5103857418 for ; Wed, 11 May 2022 05:38:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BB5103857418 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=netspace.net.au Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=netspace.net.au IronPort-SDR: Vcg7vOVxgO9F58jxOi5gG+hbZYZ2gso/mY1cugNGDGs6T2hjn2SOSXr1gxp9Ufqv5+iykmOgsD KvxJe99spOl3UGsxbXrLtbi7CeZhXBKO0vNSW08CvLYdYugJnvJEqBbaImhnbiwMkZjeTVrWR5 lxHB/SWIEUlaNUvrX0FI89jaCK65I/146S/D7K6XhZz5sc2z0OY87R+JwkMny+pA/rl9v1yxak bE5XkXZYFCY225ttx54J05SizzpITIRVm53b6IkG7wVGZx75JYyixgoOxDoy8ARCjRg/COdnmk MJU= X-SMTP-MATCH: 1 IronPort-Data: A9a23:4wpKPqC8InJOXhVW/4bhw5YqxClBgxIJ4kV8jS/XYbTApGsg3jIFn WQfXGmCOfaMY2P0Lo1xbInl900HvZTWnYVgTANkpHpgcSlH+JHPbTi7wuccHM8zwunrFh8PA xA2M4GYRCwMo/61Si6FatANl1ElvU2zbue6Wbes1hxZH1c+En980Es7wobVv6Yz6TSHK1LV0 T/Ni5CHULOV82Yc3rU8sv/rRLtH5ZweiRtA1rAMTakjUGz2zhH5OKkiyZSZdBMUdGX18tmSH I4vxJnhlo/Q10t2UIv9yt4XeGVSKlLZFVDmZnZ+B/P42kAazsA/+v5TCRYSVatYo23XlvN44 d9cib+TUVsoAZ/Slv4tcQYNRkmSPYUekFPGCUvm4JbVlhOWNSOqmqVbZK00FdRIoqAtWTkIr K1JbmFXBvyAr7veLLaTUOt3hs08BM/mIJgHs3ptizfUEbAvXPgvRo2RtY4GjWtv35km8fD2a dMHUHl1bzL8eRRta2wNB7YQp/qBiSyqG9FfgBfPzUYt2EDIxwxu2bLFNNvTZ8zPQJsFnQCfv G2u12v1CDkBM8GFwjea+2ihwOjVkkvGtJk6Te3gs6Qy2BjKlz1WWUdQWUq95/i4jEOiHdRSN wod50LCsJQPyaBidfGlNzXQnZJOlkd0twZ4ewHi1Dyw9w== IronPort-HdrOrdr: A9a23:V1t/pKyzUfn3kjTMDmN+KrPwF71zdoMgy1knxilNoH1uA7Slfq WV9sjzuiWE6gr5NEtQ/exoW5PwOE80l6QFgrX5VI3KNGKHhILBFuBfBODZslvd8kPFh4lgPG RbH5SWyuecMbG3t6nHCXKDYrMdKRC8npyVuQ== X-IronPort-AV: E=Sophos;i="5.91,216,1647273600"; d="scan'208";a="389694711" Received: from 180-200-199-92.dyn.iinet.net.au (HELO [192.168.0.18]) ([180.200.199.92]) by icp-osb-irony-out3.iinet.net.au with ESMTP; 11 May 2022 13:38:05 +0800 Subject: Re: sizeof From: Russell Shaw To: gdb@sourceware.org, Andreas Schwab References: <89fec0c3-8259-4951-5478-2afe6e0f1643@simark.ca> <0bc59583-bc2f-0ca7-e5eb-6f371ca402e1@netspace.net.au> <8735hh3l98.fsf@igel.home> <6772c7d9-8242-2946-3a74-9e6b05f9daf8@netspace.net.au> Message-ID: Date: Wed, 11 May 2022 15:38:04 +1000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <6772c7d9-8242-2946-3a74-9e6b05f9daf8@netspace.net.au> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb" Andreas Schwab wrote: >On Mai 11 2022, Russell Shaw wrote: > >> "int()" is not an expression, but a type-id for a function pointer "int(*)()" > >Where does it say that? ***************** 7.2 Properties of expressions 7.2.1 Value category 2) Every expression belongs to exactly one of the fundamental classifications in this taxonomy: lvalue, xvalue, or prvalue. This property of an expression is called its value category. ***************** Does "int()" look like a lvalue, xvalue, or prvalue ? ***************** 9.3.3 Ambiguity resolution [dcl.ambig.res] 1) ... Just as for the ambiguities mentioned in 8.9, the resolution is to consider any construct that matches the syntax of a declaration to be a declaration. ***************** Note that a type-id is a declaration syntax. The parameter "int()" of "void f(int())" is a type-id because: template-parameter : type-parameter type-parameter : type-parameter-key identifier(opt) = type-id Therefore, decaying "int()" to "int(*)()" is not performed on an expression, so none of the prohibitions about standard conversions (an expression concept) applies. ***************** 9.3.3 Ambiguity resolution [dcl.ambig.res] 2) ... void foo(signed char a) { sizeof(int()); // type-id (ill-formed) ... } ***************** The standard has an error because "int()" is a valid type-id void f(int());