On Wed, Mar 20, 2019 at 04:56:33PM -0300, Alexandre Oliva wrote:
> On Mar 20, 2019, Marek Polacek <pola...@redhat.com> wrote:
> 
> > This test fails with
> > pr88534.C:58:1: sorry, unimplemented: string literal in function template 
> > signature
> 
> Interesting...  gcc-8 rejected it with an error message rejecting the
> template parameter, but my latest trunk build (dated Mar 13, r269641)
> compiles it all right.  Was there a subsequent fix, maybe?  I didn't
> realize it was supposed to be rejected.

Ah, that problem only started with r269814, namely this hunk:

--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -824,10 +824,9 @@ store_init_value (tree decl, tree init, vec<tree, va_gc>** 
cleanups, int flags)
       value = digest_init_flags (type, init, flags, tf_warning_or_error);
     }
 
-  if (TREE_CODE (type) == ARRAY_TYPE
-      && TYPE_STRING_FLAG (TREE_TYPE (type))
-      && TREE_CODE (value) == CONSTRUCTOR)
-    value = braced_list_to_string (type, value);
+  /* Look for braced array initializers for character arrays and
+     recursively convert them into STRING_CSTs.  */
+  value = braced_lists_to_strings (type, value);
 
   current_ref_temp_count = 0;
   value = extend_ref_init_temps (decl, value, cleanups);

which now changes

  {.content={116, 101, 115, 116, 0}}

to

  {.content="test"}

Marek

Reply via email to