From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 98240 invoked by alias); 28 Jan 2019 09:37:16 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 98232 invoked by uid 89); 28 Jan 2019 09:37:15 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=Makes, 96, Song, song X-HELO: mail-vs1-f51.google.com Received: from mail-vs1-f51.google.com (HELO mail-vs1-f51.google.com) (209.85.217.51) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 28 Jan 2019 09:37:14 +0000 Received: by mail-vs1-f51.google.com with SMTP id x64so9341730vsa.5 for ; Mon, 28 Jan 2019 01:37:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=aJqFRCRst+mOCHMNtH+gZ5K0HCRPX27/ts06kogN/dk=; b=imPKfLl+93njfBtC0I/mkfXEx+dLoA9Zim0DRptZHC3eIBdf98alyKR/oyFj2rA2NK KxSJ6h3xa3h23gJ4TLdtNfijaZSCyrFJI/q2PalHUNiwSsBhGu+YBWsjk8z4KC/WdYJE fUdXh/lfG3Jgc+/7lSi3DC5rdEuESDy1UNJyo= MIME-Version: 1.0 References: <20190124191614.GG26714@redhat.com> <20190125170957.GL26714@redhat.com> <8fb80442-9bbc-38fa-5b87-3aa940284fad@redhat.com> <20190125232227.GQ26714@redhat.com> In-Reply-To: From: Christophe Lyon Date: Mon, 28 Jan 2019 09:48:00 -0000 Message-ID: Subject: Re: C++ PATCH for c++/89024 - ICE with incomplete enum type To: Jason Merrill Cc: Marek Polacek , Tim Song , GCC Patches Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2019-01/txt/msg01589.txt.bz2 On Sun, 27 Jan 2019 at 01:25, Jason Merrill wrote: > > On Fri, Jan 25, 2019 at 6:22 PM Marek Polacek wrote: > > > > On Fri, Jan 25, 2019 at 12:14:07PM -0500, Jason Merrill wrote: > > > On 1/25/19 12:09 PM, Marek Polacek wrote: > > > > On Fri, Jan 25, 2019 at 10:55:55AM -0600, Tim Song wrote: > > > > > On Thu, Jan 24, 2019 at 4:14 PM Jason Merrill wrote: > > > > > > > > > > > > On 1/24/19 2:16 PM, Marek Polacek wrote: > > > > > > > This test ICEs since r159006 which added > > > > > > > > > > > > > > type = ENUM_UNDERLYING_TYPE (type); > > > > > > > > > > > > > > to type_promotes_to. In this test ENUM_UNDERLYING_TYPE is null because we > > > > > > > haven't yet parsed '}' of the enum and the underlying type isn't fixed, and > > > > > > > so checking TYPE_UNSIGNED crashed. > > > > > > > > > > > > > > I've added some checks to the test to see if the types seem to be OK; clang++ > > > > > > > agrees. > > > > > > > > > > > > > > Bootstrapped/regtested on x86_64-linux, ok for trunk/8/7? > > > > > > > > > > > > > > 2019-01-24 Marek Polacek > > > > > > > > > > > > > > PR c++/89024 - ICE with incomplete enum type. > > > > > > > * cvt.c (type_promotes_to): Check if prom is non-null. > > > > > > > > > > > > 9.6/6: An enumeration whose underlying type is not fixed is an > > > > > > incomplete type from its point of declaration to immediately after the > > > > > > closing } of its enum-specifier, at which point it becomes a complete type. > > > > > > > > > > > > So the conversion is ill-formed. > > > > > > > > > > > > Jason > > > > > > > > > > But the conversion in the example (in > > > > > decltype(__test_aux<_To1>(declval<_From1>()))) > > > > > is in a SFINAE context, so shouldn't it gracefully fall back to the > > > > > `(...)` overload? > > > > > > > > I think so, and clang++ and icc also compile the testcase fine (and we used to > > > > too, before r159006). > > > > > > Absolutely, the conversion being ill-formed means substitution fails, and we > > > reject that candidate. I meant that we shouldn't get as far as > > > type_promotes_to for an incomplete type. > > > > Makes sense. So here's another attempt: > > > > Bootstrapped/regtested on x86_64-linux, ok for trunk? > > > > 2019-01-25 Marek Polacek > > > > PR c++/89024 - ICE with incomplete enum type. > > * call.c (standard_conversion): When converting an > > ARITHMETIC_TYPE_P to an incomplete type, return NULL. > > OK. > Hi, The new test fails on arm-eabi (with newlib, but passes on on arm*linux*): FAIL: g++.dg/cpp0x/enum37.C -std=c++14 (test for excess errors) FAIL: g++.dg/cpp0x/enum37.C -std=c++17 (test for excess errors) The log says: /gcc/testsuite/g++.dg/cpp0x/enum37.C:24:41: error: aggregate 'same s2' has incomplete type and cannot be defined Christophe > Jason