+2020-01-29 Marek Polacek <polacek@redhat.com>
+
+ PR c++/91754 - Fix template arguments comparison with class NTTP.
+ * pt.c (class_nttp_const_wrapper_p): New.
+ (template_args_equal): See through class_nttp_const_wrapper_p
+ arguments.
+
2020-01-29 Marek Polacek <polacek@redhat.com>
PR c++/92948 - Fix class NTTP with template arguments.
return coerced_args;
}
+/* Returns true if T is a wrapper to make a C++20 template parameter
+ object const. */
+
+static bool
+class_nttp_const_wrapper_p (tree t)
+{
+ if (cxx_dialect < cxx2a)
+ return false;
+ return (TREE_CODE (t) == VIEW_CONVERT_EXPR
+ && CP_TYPE_CONST_P (TREE_TYPE (t))
+ && TREE_CODE (TREE_OPERAND (t, 0)) == TEMPLATE_PARM_INDEX);
+}
+
/* Returns 1 if template args OT and NT are equivalent. */
int
if (nt == any_targ_node || ot == any_targ_node)
return true;
+ if (class_nttp_const_wrapper_p (nt))
+ nt = TREE_OPERAND (nt, 0);
+ if (class_nttp_const_wrapper_p (ot))
+ ot = TREE_OPERAND (ot, 0);
+
if (TREE_CODE (nt) == TREE_VEC)
/* For member templates */
return TREE_CODE (ot) == TREE_VEC && comp_template_args (ot, nt);
+2020-01-29 Marek Polacek <polacek@redhat.com>
+
+ PR c++/91754 - Fix template arguments comparison with class NTTP.
+ * g++.dg/cpp2a/nontype-class30.C: New test.
+
2020-01-29 Marek Polacek <polacek@redhat.com>
PR c++/92948 - Fix class NTTP with template arguments.