From patchwork Wed Jan 4 16:44:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 711056 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ttxVL1YKGz9t1Q for ; Thu, 5 Jan 2017 03:44:25 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="y56601Y+"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=KMm6VjwLvc3eV+r8J 1cu4fhRKgT0/BLhh9xqzUUB5jKBnXMu8BsWlHlUn83bSE3y0vmBKXzD/OMB4RqaC q0lCFZ8Me2Xsw0Y6TdzitwFZn8cO+ZgTihT3apyHTn930dXEjztIt5X96l0EDkjG 8vzDZgfOyAcLdORW8q/Noi/n0Y= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=LjDBFuJFaUt58LdEQoRILjx FbmY=; b=y56601Y+XGAllq24MhltiwHQbQeLTJSAvhtLU61wNFi9MgRKWVo971J pNoh/ogk+q+C27TXVDJMMFMxPrEt6gz1x3vNS+2RZooEXc5PaEfcEK5lBb7GcEJO GJ2lmvdikpG+xqKDJuFSV7XzBiZttvIDNeYKYINBJTntHb1zu+bE= Received: (qmail 126597 invoked by alias); 4 Jan 2017 16:44:17 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 126588 invoked by uid 89); 4 Jan 2017 16:44:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.8 required=5.0 tests=BAYES_05, FREEMAIL_FROM, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=no version=3.3.2 spammy=U*nathan, nathan@acm.org, nathanacmorg, 78765 X-HELO: mail-yw0-f196.google.com Received: from mail-yw0-f196.google.com (HELO mail-yw0-f196.google.com) (209.85.161.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 04 Jan 2017 16:44:06 +0000 Received: by mail-yw0-f196.google.com with SMTP id b66so42108732ywh.2 for ; Wed, 04 Jan 2017 08:44:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:cc:from:message-id :date:user-agent:mime-version:in-reply-to; bh=PwuqmR29zbiIfpIJyOdZqqynyW28Wal1+G6icQVTVDs=; b=NKRBVaNZqIKnu8SQN892tsoXy3ei0v9xXZ76Yc1AsRfY6rTIdUBMVh08au1AW7QunQ AIcDnNUeKEeZfglTil2Pl6ITY4I8VVAT1+DGQ7dJVzHkf6qBjD7RG/IlpNzujHOpWubK kSNIIXgAl74FonYUygDn9fHMFlHOROB7/DEc3xTKR1wwzCzyTiuk2k5/4iuotWUdQT7D oNNeO8fLfdevqnh82/bsuuEragdMaf/FjH5Wp9B3VtTq2SRnBT8fSek+w66FR/2NZAKF 3WhehBPkNbFrXkcDLWacFdVElu1/l57J85PHueF15ZYWqmpWov1Yw//xYbaj14gobt5g Yp4A== X-Gm-Message-State: AIkVDXJR7tvzG35kINDGYo+/TfawkWOcnSDBAyMD27vrjehtvoWs7KsgiRTeDJTkn+6Niw== X-Received: by 10.13.195.67 with SMTP id f64mr62705255ywd.249.1483548244701; Wed, 04 Jan 2017 08:44:04 -0800 (PST) Received: from ?IPv6:2620:10d:c0a3:20fb:f6d0:5ac5:64cd:f102? ([2620:10d:c091:200::e:a6d2]) by smtp.googlemail.com with ESMTPSA id p193sm30444239ywe.55.2017.01.04.08.44.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Jan 2017 08:44:04 -0800 (PST) Subject: Re: [PATCH] c++/78765 To: Jason Merrill References: <4e074ce1-b1d5-87c9-2593-713ccc5daf92@redhat.com> <0d7b534a-6c81-f415-b35b-bb641e47d054@acm.org> Cc: GCC Patches From: Nathan Sidwell Message-ID: Date: Wed, 4 Jan 2017 11:44:02 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: On 01/04/2017 10:13 AM, Jason Merrill wrote: > OK, that looks like the problem; we shouldn't be calling > maybe_constant_value before we perform the conversion. Yup, that worked. ok? nathan 2017-01-04 Nathan Sidwell cp/ PR c++/78765 * pt.c (convert_nontype_argument): Don't try and see if integral or enum expressions are constants prematurely. testsuite/ PR c++/78765 * g++.dg/cpp0x/pr78765.C: New. Index: cp/pt.c =================================================================== --- cp/pt.c (revision 244056) +++ cp/pt.c (working copy) @@ -6386,7 +6386,7 @@ convert_nontype_argument (tree type, tre to leave it in that form rather than lower it to a CONSTRUCTOR. */; else if (INTEGRAL_OR_ENUMERATION_TYPE_P (type)) - expr = maybe_constant_value (expr); + /* Constant value checking is done later with type conversion. */; else if (cxx_dialect >= cxx1z) { if (TREE_CODE (type) != REFERENCE_TYPE) Index: testsuite/g++.dg/cpp0x/pr78765.C =================================================================== --- testsuite/g++.dg/cpp0x/pr78765.C (revision 0) +++ testsuite/g++.dg/cpp0x/pr78765.C (working copy) @@ -0,0 +1,15 @@ +// PR c++/78765 +// { dg-do compile { target c++11 } } + +// ICE with failed constexpr object and member fn call + +struct ValueType { + constexpr operator int() const {return field;} + int field; +}; + +static constexpr ValueType var = 0; // { dg-error "conversion" } + +template class ValueTypeInfo; + +ValueTypeInfo x;