Message ID | 20231212212143.64983-1-ppalka@redhat.com |
---|---|
State | Unresolved |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp8010570vqy; Tue, 12 Dec 2023 13:22:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IEs5/UTeLajohTh0Z+f2g7UmPQuI3BBkTFHh6q6PHJAY6GKZK+arraUp3znqyRInL1aZZ3f X-Received: by 2002:a05:622a:1792:b0:425:89a1:b2ec with SMTP id s18-20020a05622a179200b0042589a1b2ecmr10417844qtk.100.1702416134386; Tue, 12 Dec 2023 13:22:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702416134; cv=pass; d=google.com; s=arc-20160816; b=QxcQcCK+svNG8/+dVgcAPPDrhF25W6qwUWXM4Zjtxv2Eoeli0L2Jg8Q0s5sMGqVhXj ynyWnbb+Y78qTkRL4BeQKEzQtCh4STJrldHBSyk6EBSPQMz5+SUw7HjuSRzcPU/owv1K EMJLfJihi6EoxnkeScfib7AVJgf8gUyqViU+Z7C80kCQxZ3do9xorepg1nR9rVKbKiYP 4camlR1A/F1Z4iHN3tuRP8st5/a4RMGaHZlnBe6b5vOkGoyAd22rqeyn6r8xFUwo4zlH KFvIxdoDoWB4K2RvT8J2sEQAotDGct+5wAdiKddtecAArWofW13/6Q4gzjMhZeM0K1+U Cekw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=ZLy/jYWpKyBkFUn2X/D9sJzf4fukgcjFeFVzdAum+AQ=; fh=1Hi9m88IqcWZGtfSxUrMGG+GBgL26N02X1SANXM6iTs=; b=I7bRWUGtUvtjNvJo2ZeICdvBuwd413eQ3K46OeV2A8UXBgpnxNsr1jitOxd+gEVgtq LQmxjbFH5UWRjirxfiDR4F0l9GzEE9L2Qq92Sg7TPn+67/SEgwBx6vKRU2F/h/KV/wpB eMAdl114LKjhJorxzglfudqIX3Wl92uGkfB9Es7LEQWyWRmkx71fDaIO6SMMhK21WjF3 8MYl/1KbB+f+4lL79b9+izulEcxjsLfhqtKEQISsU5zF1A4L4ysJ/ngT+yO/tByUuQcK SSfzpVqnPaOBCEm2GO6tYz4wtqgg7cwk1huxLBwqjTk33utSg0ifGy8W0dpaxlev1zA5 98FA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Sd80Vryq; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id jd9-20020a05622a718900b0042376b87e12si12705091qtb.294.2023.12.12.13.22.14 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 13:22:14 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Sd80Vryq; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2C5553857C69 for <ouuuleilei@gmail.com>; Tue, 12 Dec 2023 21:22:14 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 0771E3858C78 for <gcc-patches@gcc.gnu.org>; Tue, 12 Dec 2023 21:21:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0771E3858C78 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0771E3858C78 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702416112; cv=none; b=BkoQ3uUBLGYeMHPEYJtmsr+dRoZJa0vCbix/NG+Nlntf0M5ZiO3mfhsYuvnO6LG15tGZfWyk5fuWCVqUd11oA24c+utW8zbO5sDujLzrRnouz0t7rhGSRvOeI2OjBXQm8rvN7ZeWjS1vLpg+UJhb27TVPs+tfroPuP0K8no3mG8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702416112; c=relaxed/simple; bh=XOKVggKWjE6RT1fbUwsjS+mQ4WUBrxJeOf0ww7vB8po=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=JtnhK05ILRhCZetahclpCB+hHhkQ05ZtEuEcseztq+NIZng29zNuFLpXeZX4HdAkVtuz0gs258LVclmZKDy2lPbDAgLSHvR2IB23DENiixd9gfTSjhBRiSGVnGDiWCBU8+Vpi9dg7EnalZrxpLgGyPSNDnb+Q+5EzEMHP7woFYE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702416110; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZLy/jYWpKyBkFUn2X/D9sJzf4fukgcjFeFVzdAum+AQ=; b=Sd80VryqwL7xi9d2/Z5jRoPh0/NQU6sBDnhbNHaZcMPlHqxvcUTkjDMRGsagPB25bK3BVQ k7G7RWVckUmUwCclR8CNmCnFma85yyR17CwHVVjHkAyTb2jnhKXSUZ/agtMlKt56qCj3pl YjmROXwX9By/zBLu1XazpliYkvtDAds= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-91-2m7XdQ3mOsqEfRXjObyq_A-1; Tue, 12 Dec 2023 16:21:49 -0500 X-MC-Unique: 2m7XdQ3mOsqEfRXjObyq_A-1 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-67ef53b1f17so1905066d6.3 for <gcc-patches@gcc.gnu.org>; Tue, 12 Dec 2023 13:21:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702416107; x=1703020907; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ZLy/jYWpKyBkFUn2X/D9sJzf4fukgcjFeFVzdAum+AQ=; b=TkOjS2vtLGVkrYzCZAw/yUQwr1ttTMqUHPIReDWyahdIAnji/FMc3ZR3Onp3B0h8Ui xBXu53uMmHmW6e/3jFpvDDB003k2CP6VLQYLY/17s2cfncmdTfzi4aVKgSbZVxTuvXRI kwXqzQdKhEDi8yX+zyzf/aF9PMZlMaeQSq+uMnlrAk5hPO5QxtR4WifKObZ1anGx5tL3 FJuvpETjFjDekmMzHhAFcWnJws5jHo11xIOs93sdXbh/gyDXyWPUMFCBp68gAUgLKNP6 xGu0xIGcUr1cUb/h+luORzg9tYLG3jpN+ikFtiahdP0a96Ux7nBN/uyHN0txi214xDmB g5AQ== X-Gm-Message-State: AOJu0Yw0GvAr97pQ1TwESF8VcfPw8A8zfBScUJuW/69x+uAb6C7E5KuT YvKWkmf0+0/gnpjjT2GGr6bBtbovaXiJm/vpEqy0qtlEd2LfEYRi27eOFGCBjpSxaFcd8Ilx7mc qK3pwSnBFxFXNjAqrpQ8E4xZjQl3YX/a/XJGS+5U9K/MP4JHUOZxred1dn7Gahu7cHFJxW/XD7h k= X-Received: by 2002:a05:622a:288:b0:425:4043:50d2 with SMTP id z8-20020a05622a028800b00425404350d2mr9828879qtw.97.1702416107181; Tue, 12 Dec 2023 13:21:47 -0800 (PST) X-Received: by 2002:a05:622a:288:b0:425:4043:50d2 with SMTP id z8-20020a05622a028800b00425404350d2mr9828866qtw.97.1702416106846; Tue, 12 Dec 2023 13:21:46 -0800 (PST) Received: from localhost.localdomain (ool-457670bb.dyn.optonline.net. [69.118.112.187]) by smtp.gmail.com with ESMTPSA id e7-20020ac845c7000000b00418122186ccsm4362201qto.12.2023.12.12.13.21.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 13:21:46 -0800 (PST) From: Patrick Palka <ppalka@redhat.com> To: gcc-patches@gcc.gnu.org Cc: jason@redhat.com, Patrick Palka <ppalka@redhat.com> Subject: [PATCH] c++: unifying constants vs their type [PR99186, PR104867] Date: Tue, 12 Dec 2023 16:21:43 -0500 Message-ID: <20231212212143.64983-1-ppalka@redhat.com> X-Mailer: git-send-email 2.43.0.76.g1a87c842ec MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, RCVD_IN_SORBS_WEB, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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>, <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>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785112700684241264 X-GMAIL-MSGID: 1785112700684241264 |
Series |
c++: unifying constants vs their type [PR99186, PR104867]
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | warning | Git am fail log |
Commit Message
Patrick Palka
Dec. 12, 2023, 9:21 p.m. UTC
Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk? -- >8 -- When unifying constants we need to generally treat constants of different types but same value as different, in light of auto template parameters. This patch fixes this in a minimal way; it seems we could get away with just using template_args_equal here, as we do in the default case, but that's a simplification we could look into during next stage 1. PR c++/99186 PR c++/104867 gcc/cp/ChangeLog: * pt.cc (unify) <case INTEGER_CST>: Compare types as well. gcc/testsuite/ChangeLog: * g++.dg/cpp1z/nontype-auto23.C: New test. * g++.dg/cpp1z/nontype-auto24.C: New test. --- gcc/cp/pt.cc | 2 ++ gcc/testsuite/g++.dg/cpp1z/nontype-auto23.C | 23 +++++++++++++++++++++ gcc/testsuite/g++.dg/cpp1z/nontype-auto24.C | 18 ++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1z/nontype-auto23.C create mode 100644 gcc/testsuite/g++.dg/cpp1z/nontype-auto24.C
Comments
On Tue, 12 Dec 2023, Patrick Palka wrote: > Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK > for trunk? > > -- >8 -- > > When unifying constants we need to generally treat constants of > different types but same value as different, in light of auto template > parameters. This patch fixes this in a minimal way; it seems we could > get away with just using template_args_equal here, as we do in the or just cp_tree_equal for that matters because ... > default case, but that's a simplification we could look into during next > stage 1. > > PR c++/99186 > PR c++/104867 > > gcc/cp/ChangeLog: > > * pt.cc (unify) <case INTEGER_CST>: Compare types as well. > > gcc/testsuite/ChangeLog: > > * g++.dg/cpp1z/nontype-auto23.C: New test. > * g++.dg/cpp1z/nontype-auto24.C: New test. > --- > gcc/cp/pt.cc | 2 ++ > gcc/testsuite/g++.dg/cpp1z/nontype-auto23.C | 23 +++++++++++++++++++++ > gcc/testsuite/g++.dg/cpp1z/nontype-auto24.C | 18 ++++++++++++++++ > 3 files changed, 43 insertions(+) > create mode 100644 gcc/testsuite/g++.dg/cpp1z/nontype-auto23.C > create mode 100644 gcc/testsuite/g++.dg/cpp1z/nontype-auto24.C > > diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc > index a8966e223f1..602dd02d29d 100644 > --- a/gcc/cp/pt.cc > +++ b/gcc/cp/pt.cc > @@ -24709,6 +24709,8 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict, > /* Type INTEGER_CST can come from ordinary constant template args. */ > case INTEGER_CST: > case REAL_CST: > + if (!same_type_p (TREE_TYPE (parm), TREE_TYPE (arg))) > + return unify_template_argument_mismatch (explain_p, parm, arg); > while (CONVERT_EXPR_P (arg)) > arg = TREE_OPERAND (arg, 0); ... this while loop seems to be dead code. > > diff --git a/gcc/testsuite/g++.dg/cpp1z/nontype-auto23.C b/gcc/testsuite/g++.dg/cpp1z/nontype-auto23.C > new file mode 100644 > index 00000000000..467559ffdda > --- /dev/null > +++ b/gcc/testsuite/g++.dg/cpp1z/nontype-auto23.C > @@ -0,0 +1,23 @@ > +// PR c++/99186 > +// { dg-do compile { target c++17 } } > + > +template<int N, typename T, typename... U> > +struct tuple_impl : tuple_impl<N + 1, U...> { }; > + > +template<int N, typename T> > +struct tuple_impl<N, T> { }; > + > +template<typename T, typename U> > +struct tuple : tuple_impl<0, T, U> { }; > + > +template<typename T, int N, typename... U> > +void get(const tuple_impl<N, T, U...>&); > + > +template<auto> > +struct S; > + > +int main() { > + tuple<S<1>,S<1U>> x; > + get<S<1U>>(x); > + get<S<1>>(x); > +} > diff --git a/gcc/testsuite/g++.dg/cpp1z/nontype-auto24.C b/gcc/testsuite/g++.dg/cpp1z/nontype-auto24.C > new file mode 100644 > index 00000000000..52e4c134ccd > --- /dev/null > +++ b/gcc/testsuite/g++.dg/cpp1z/nontype-auto24.C > @@ -0,0 +1,18 @@ > +// PR c++/104867 > +// { dg-do compile { target c++17 } } > + > +enum class Foo { A1 }; > + > +enum class Bar { B1 }; > + > +template<auto EnumVal> struct enum_; > + > +template<class...> struct list { }; > + > +template<class V> void f(list<enum_<Bar::B1>, V>); > + > +struct enum_type_map : list<enum_<Foo::A1>, int>, list<enum_<Bar::B1>, double> { }; > + > +int main() { > + f(enum_type_map()); > +} > -- > 2.43.0.76.g1a87c842ec > >
On 12/12/23 16:21, Patrick Palka wrote: > Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK > for trunk? OK. > -- >8 -- > > When unifying constants we need to generally treat constants of > different types but same value as different, in light of auto template > parameters. This patch fixes this in a minimal way; it seems we could > get away with just using template_args_equal here, as we do in the > default case, but that's a simplification we could look into during next > stage 1. > > PR c++/99186 > PR c++/104867 > > gcc/cp/ChangeLog: > > * pt.cc (unify) <case INTEGER_CST>: Compare types as well. > > gcc/testsuite/ChangeLog: > > * g++.dg/cpp1z/nontype-auto23.C: New test. > * g++.dg/cpp1z/nontype-auto24.C: New test. > --- > gcc/cp/pt.cc | 2 ++ > gcc/testsuite/g++.dg/cpp1z/nontype-auto23.C | 23 +++++++++++++++++++++ > gcc/testsuite/g++.dg/cpp1z/nontype-auto24.C | 18 ++++++++++++++++ > 3 files changed, 43 insertions(+) > create mode 100644 gcc/testsuite/g++.dg/cpp1z/nontype-auto23.C > create mode 100644 gcc/testsuite/g++.dg/cpp1z/nontype-auto24.C > > diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc > index a8966e223f1..602dd02d29d 100644 > --- a/gcc/cp/pt.cc > +++ b/gcc/cp/pt.cc > @@ -24709,6 +24709,8 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict, > /* Type INTEGER_CST can come from ordinary constant template args. */ > case INTEGER_CST: > case REAL_CST: > + if (!same_type_p (TREE_TYPE (parm), TREE_TYPE (arg))) > + return unify_template_argument_mismatch (explain_p, parm, arg); > while (CONVERT_EXPR_P (arg)) > arg = TREE_OPERAND (arg, 0); > > diff --git a/gcc/testsuite/g++.dg/cpp1z/nontype-auto23.C b/gcc/testsuite/g++.dg/cpp1z/nontype-auto23.C > new file mode 100644 > index 00000000000..467559ffdda > --- /dev/null > +++ b/gcc/testsuite/g++.dg/cpp1z/nontype-auto23.C > @@ -0,0 +1,23 @@ > +// PR c++/99186 > +// { dg-do compile { target c++17 } } > + > +template<int N, typename T, typename... U> > +struct tuple_impl : tuple_impl<N + 1, U...> { }; > + > +template<int N, typename T> > +struct tuple_impl<N, T> { }; > + > +template<typename T, typename U> > +struct tuple : tuple_impl<0, T, U> { }; > + > +template<typename T, int N, typename... U> > +void get(const tuple_impl<N, T, U...>&); > + > +template<auto> > +struct S; > + > +int main() { > + tuple<S<1>,S<1U>> x; > + get<S<1U>>(x); > + get<S<1>>(x); > +} > diff --git a/gcc/testsuite/g++.dg/cpp1z/nontype-auto24.C b/gcc/testsuite/g++.dg/cpp1z/nontype-auto24.C > new file mode 100644 > index 00000000000..52e4c134ccd > --- /dev/null > +++ b/gcc/testsuite/g++.dg/cpp1z/nontype-auto24.C > @@ -0,0 +1,18 @@ > +// PR c++/104867 > +// { dg-do compile { target c++17 } } > + > +enum class Foo { A1 }; > + > +enum class Bar { B1 }; > + > +template<auto EnumVal> struct enum_; > + > +template<class...> struct list { }; > + > +template<class V> void f(list<enum_<Bar::B1>, V>); > + > +struct enum_type_map : list<enum_<Foo::A1>, int>, list<enum_<Bar::B1>, double> { }; > + > +int main() { > + f(enum_type_map()); > +}
diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index a8966e223f1..602dd02d29d 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -24709,6 +24709,8 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict, /* Type INTEGER_CST can come from ordinary constant template args. */ case INTEGER_CST: case REAL_CST: + if (!same_type_p (TREE_TYPE (parm), TREE_TYPE (arg))) + return unify_template_argument_mismatch (explain_p, parm, arg); while (CONVERT_EXPR_P (arg)) arg = TREE_OPERAND (arg, 0); diff --git a/gcc/testsuite/g++.dg/cpp1z/nontype-auto23.C b/gcc/testsuite/g++.dg/cpp1z/nontype-auto23.C new file mode 100644 index 00000000000..467559ffdda --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/nontype-auto23.C @@ -0,0 +1,23 @@ +// PR c++/99186 +// { dg-do compile { target c++17 } } + +template<int N, typename T, typename... U> +struct tuple_impl : tuple_impl<N + 1, U...> { }; + +template<int N, typename T> +struct tuple_impl<N, T> { }; + +template<typename T, typename U> +struct tuple : tuple_impl<0, T, U> { }; + +template<typename T, int N, typename... U> +void get(const tuple_impl<N, T, U...>&); + +template<auto> +struct S; + +int main() { + tuple<S<1>,S<1U>> x; + get<S<1U>>(x); + get<S<1>>(x); +} diff --git a/gcc/testsuite/g++.dg/cpp1z/nontype-auto24.C b/gcc/testsuite/g++.dg/cpp1z/nontype-auto24.C new file mode 100644 index 00000000000..52e4c134ccd --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/nontype-auto24.C @@ -0,0 +1,18 @@ +// PR c++/104867 +// { dg-do compile { target c++17 } } + +enum class Foo { A1 }; + +enum class Bar { B1 }; + +template<auto EnumVal> struct enum_; + +template<class...> struct list { }; + +template<class V> void f(list<enum_<Bar::B1>, V>); + +struct enum_type_map : list<enum_<Foo::A1>, int>, list<enum_<Bar::B1>, double> { }; + +int main() { + f(enum_type_map()); +}