From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eidolon.nox.tf (eidolon.nox.tf [IPv6:2a07:2ec0:2185::]) by sourceware.org (Postfix) with ESMTPS id 534C53851C36 for ; Wed, 10 Mar 2021 19:06:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 534C53851C36 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=diac24.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=equinox@diac24.net Received: from equinox by eidolon.nox.tf with local (Exim 4.94) (envelope-from ) id 1lK49y-008NWC-Uk; Wed, 10 Mar 2021 20:06:19 +0100 Date: Wed, 10 Mar 2021 20:06:18 +0100 From: David Lamparter To: Martin Sebor Cc: gcc-patches Subject: Re: [PATCH] c: don't drop typedef information in casts Message-ID: References: <20210310012815.3797974-1-equinox@diac24.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 19:06:21 -0000 On Wed, Mar 10, 2021 at 08:02:16PM +0100, David Lamparter wrote: > Also, in seeing your response re. the volatile, it occured to me that > stripping qualifiers on a typedef and still calling it the typedef is > unhelpful. Ideally, my goal is: > > typedef int i; > typedef const int ci; > typeof((i)x) = i > typeof((ci)x) = int (<-- w/ my patch = ci; this is confusing) Clarification: with the current patch, the type of (ci)x is *called* "ci", but doesn't actually have the const qualifier. That's the confusing part. The const (or volatile) is stripped off the typedef in the added build_qualified_type() call, but that now-different type is still referred to as "ci"... > typeof((const i)x) = i