aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2014-04-18 14:11:22 -0400
committerJason Merrill <jason@gcc.gnu.org>2014-04-18 14:11:22 -0400
commitc663bc6a4ff37bf6cb3d6d05c9862e17236051ec (patch)
tree72fc1e93e4bf93635da99c287bee8ac9c7105b9a
parent8a3a7e67a1514815319cde8141b2edb0e7ed8701 (diff)
downloadgcc-c663bc6a4ff37bf6cb3d6d05c9862e17236051ec.zip
gcc-c663bc6a4ff37bf6cb3d6d05c9862e17236051ec.tar.gz
gcc-c663bc6a4ff37bf6cb3d6d05c9862e17236051ec.tar.bz2
re PR c++/60872 (Cannot memcpy array of restricted pointers)
PR c++/60872 * call.c (standard_conversion): Don't try to apply restrict to void. From-SVN: r209520
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/call.c5
-rw-r--r--gcc/testsuite/g++.dg/ext/restrict2.C8
3 files changed, 16 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index e10a227..23baee6 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2014-04-18 Jason Merrill <jason@redhat.com>
+
+ PR c++/60872
+ * call.c (standard_conversion): Don't try to apply restrict to void.
+
2014-04-16 Marc Glisse <marc.glisse@inria.fr>
* decl.c (reshape_init_r): Handle a single element of vector type.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 7dbe935..fbd2f83 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -1196,9 +1196,10 @@ standard_conversion (tree to, tree from, tree expr, bool c_cast_p,
&& TREE_CODE (TREE_TYPE (from)) != FUNCTION_TYPE)
{
tree nfrom = TREE_TYPE (from);
+ /* Don't try to apply restrict to void. */
+ int quals = cp_type_quals (nfrom) & ~TYPE_QUAL_RESTRICT;
from = build_pointer_type
- (cp_build_qualified_type (void_type_node,
- cp_type_quals (nfrom)));
+ (cp_build_qualified_type (void_type_node, quals));
conv = build_conv (ck_ptr, from, conv);
}
else if (TYPE_PTRDATAMEM_P (from))
diff --git a/gcc/testsuite/g++.dg/ext/restrict2.C b/gcc/testsuite/g++.dg/ext/restrict2.C
new file mode 100644
index 0000000..f053210
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/restrict2.C
@@ -0,0 +1,8 @@
+// PR c++/60872
+// { dg-options "" }
+
+typedef double *__restrict T;
+void f(T* p)
+{
+ void *p2 = p;
+}