]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR c++/88741 - wrong error with initializer-string.
authormpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 7 Jan 2019 19:25:41 +0000 (19:25 +0000)
committermpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 7 Jan 2019 19:25:41 +0000 (19:25 +0000)
* decl.c (cp_complete_array_type): Strip any location wrappers.

* g++.dg/init/array50.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@267656 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/init/array50.C [new file with mode: 0644]

index 60c8ae1934eca33847f34dfe8f0e8c2560ff11ee..5267b9d24f70f0c91618bc3fd3ea5ee5578b6393 100644 (file)
@@ -1,3 +1,8 @@
+2019-01-07  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/88741 - wrong error with initializer-string.
+       * decl.c (cp_complete_array_type): Strip any location wrappers.
+
 2019-01-07  Bernd Edlinger  <bernd.edlinger@hotmail.de>
 
        PR c++/88261
index 15bc4887a596849011c03f9cd98f147f5454a1d2..1fc7a1acf5601dcdb469c1207725327a911f4d82 100644 (file)
@@ -8433,6 +8433,7 @@ cp_complete_array_type (tree *ptype, tree initial_value, bool do_default)
        {
          vec<constructor_elt, va_gc> *v = CONSTRUCTOR_ELTS (initial_value);
          tree value = (*v)[0].value;
+         STRIP_ANY_LOCATION_WRAPPER (value);
 
          if (TREE_CODE (value) == STRING_CST
              && v->length () == 1)
index 4bb56349adff891e7d2358fb37ce46ef70cc52c6..c79593d7f0ebc1f93707b3bca74e5bd3185b0dcf 100644 (file)
@@ -1,3 +1,8 @@
+2019-01-07  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/88741 - wrong error with initializer-string.
+       * g++.dg/init/array50.C: New test.
+
 2019-01-07  Bernd Edlinger  <bernd.edlinger@hotmail.de>
 
        PR c++/88261
diff --git a/gcc/testsuite/g++.dg/init/array50.C b/gcc/testsuite/g++.dg/init/array50.C
new file mode 100644 (file)
index 0000000..a5c129d
--- /dev/null
@@ -0,0 +1,12 @@
+// PR c++/88741
+
+template <class T>
+void foo()
+{
+  char row[] = {"test"};
+}
+  
+void bar()
+{
+  foo<int>();
+}