Since Martin Sebor's patch for PR 71625 to change braced array initializers
to STRING_CST in some cases, we need to be ready for STRING_CST with types
that are changed by tsubst. fold_convert doesn't know how to deal with
STRING_CST, which is reasonable; we really shouldn't expect it to here. So
let's handle STRING_CST separately.
PR c++/90966
* pt.c (tsubst_copy) [STRING_CST]: Don't use fold_convert.
+2020-01-27 Jason Merrill <jason@redhat.com>
+
+ PR c++/90966
+ * pt.c (tsubst_copy) [STRING_CST]: Don't use fold_convert.
+
2020-01-27 Iain Sandoe <iain@sandoe.co.uk>
PR c++/93443
case INTEGER_CST:
case REAL_CST:
- case STRING_CST:
case COMPLEX_CST:
{
/* Instantiate any typedefs in the type. */
return r;
}
+ case STRING_CST:
+ {
+ tree type = tsubst (TREE_TYPE (t), args, complain, in_decl);
+ r = t;
+ if (type != TREE_TYPE (t))
+ {
+ r = copy_node (t);
+ TREE_TYPE (r) = type;
+ }
+ return r;
+ }
+
case PTRMEM_CST:
/* These can sometimes show up in a partial instantiation, but never
involve template parms. */
--- /dev/null
+// PR c++/90966
+// { dg-do compile { target c++11 } }
+
+template<typename I>
+void f()
+{
+ using S = signed char;
+ constexpr const S v[]{0};
+}
+
+int main()
+{
+ f<int>();
+}