From: Jason Merrill Date: Fri, 13 Dec 2019 05:09:57 +0000 (-0500) Subject: PR c++/92150 - partial specialization with class NTTP. X-Git-Tag: releases/gcc-9.3.0~317 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=549ab4bd5460080dfc331224e0372c38dcaaefce;p=thirdparty%2Fgcc.git PR c++/92150 - partial specialization with class NTTP. Here unify was getting confused by the VIEW_CONVERT_EXPR we add in finish_id_expression_1 to make class NTTP const when they're used in an expression. Tested x86_64-pc-linux-gnu, applying to trunk. * pt.c (unify): Handle VIEW_CONVERT_EXPR. From-SVN: r279332 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ae4ba4a372a2..19d70a329788 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2019-11-06 Jason Merrill + + PR c++/92150 - partial specialization with class NTTP. + * pt.c (unify): Handle VIEW_CONVERT_EXPR. + 2019-11-20 Jakub Jelinek PR c++/90767 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 48d8dbb6ad2d..aa78ac980b3c 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -22045,8 +22045,9 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict, /* I don't think this will do the right thing with respect to types. But the only case I've seen it in so far has been array bounds, where signedness is the only information lost, and I think that will be - okay. */ - while (CONVERT_EXPR_P (parm)) + okay. VIEW_CONVERT_EXPR can appear with class NTTP, thanks to + finish_id_expression_1, and are also OK. */ + while (CONVERT_EXPR_P (parm) || TREE_CODE (parm) == VIEW_CONVERT_EXPR) parm = TREE_OPERAND (parm, 0); if (arg == error_mark_node) diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class24.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class24.C new file mode 100644 index 000000000000..aa96de36a80f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class24.C @@ -0,0 +1,19 @@ +// PR c++/92150 +// { dg-do compile { target c++2a } } + +struct X { + int value; + // auto operator==(const X&) = default; +}; + +template +struct b; + +template +inline constexpr bool is_b = false; + +template +inline constexpr bool is_b> = true; + +using my_b = b; +static_assert(is_b);