summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2006-05-31 20:03:12 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2006-05-31 20:03:12 +0000
commit07471dfbf7afc818a9e52f8507fb727d20250516 (patch)
tree9348fbb31f346a3db6c887391af06665ca26393d /gcc
parent69037dd991238a58d17ee46dc7c82cae845035ff (diff)
downloadgcc-07471dfbf7afc818a9e52f8507fb727d20250516.tar.gz
re PR c++/27801 (ICE in invert_truthvalue with template)
PR c++/27801 * call.c (perform_implicit_conversion): Do not actually perform conversions in templates. PR c++/26496 * call.c (resolve_args): Check for invalid uses of bound non-static member functions. * init.c (build_offset_ref): Return error_mark_node for errors. PR c++/27385 * decl.c (reshape_init): Robustify. (reshape_init_array_1): Likewise. PR c++/27801 * g++.dg/template/cond6.C: New test. PR c++/26496 * g++.dg/template/crash51.C: New test. * g++.old-deja/g++.mike/net36.C: Tweak error markers. PR c++/27385 * g++.dg/init/array20.C: New test. From-SVN: r114278
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog15
-rw-r--r--gcc/cp/call.c10
-rw-r--r--gcc/cp/decl.c4
-rw-r--r--gcc/cp/init.c2
-rw-r--r--gcc/testsuite/ChangeLog12
-rw-r--r--gcc/testsuite/g++.dg/init/array20.C5
-rw-r--r--gcc/testsuite/g++.dg/template/cond6.C6
-rw-r--r--gcc/testsuite/g++.dg/template/crash51.C11
-rw-r--r--gcc/testsuite/g++.old-deja/g++.mike/net36.C2
9 files changed, 65 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 57d01106da3..eaa96a5a772 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,18 @@
+2006-05-31 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/27801
+ * call.c (perform_implicit_conversion): Do not actually perform
+ conversions in templates.
+
+ PR c++/26496
+ * call.c (resolve_args): Check for invalid uses of bound
+ non-static member functions.
+ * init.c (build_offset_ref): Return error_mark_node for errors.
+
+ PR c++/27385
+ * decl.c (reshape_init): Robustify.
+ (reshape_init_array_1): Likewise.
+
2006-05-30 Mark Mitchell <mark@codesourcery.com>
PR c++/27808
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 9e69772954c..2167101e2f9 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -2704,6 +2704,8 @@ resolve_args (tree args)
error ("invalid use of void expression");
return error_mark_node;
}
+ else if (invalid_nonstatic_memfn_p (arg))
+ return error_mark_node;
}
return args;
}
@@ -6388,6 +6390,14 @@ perform_implicit_conversion (tree type, tree expr)
error ("could not convert %qE to %qT", expr, type);
expr = error_mark_node;
}
+ else if (processing_template_decl)
+ {
+ /* In a template, we are only concerned about determining the
+ type of non-dependent expressions, so we do not have to
+ perform the actual conversion. */
+ if (TREE_TYPE (expr) != type)
+ expr = build_nop (type, expr);
+ }
else
expr = convert_like (conv, expr);
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 5178bdfd91d..bccb438a29b 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -4352,6 +4352,8 @@ reshape_init_array_1 (tree elt_type, tree max_index, reshape_iter *d)
}
elt_init = reshape_init_r (elt_type, d, /*first_initializer_p=*/false);
+ if (elt_init == error_mark_node)
+ return error_mark_node;
CONSTRUCTOR_APPEND_ELT (CONSTRUCTOR_ELTS (new_init), NULL_TREE, elt_init);
}
@@ -4630,6 +4632,8 @@ reshape_init (tree type, tree init)
d.end = d.cur + VEC_length (constructor_elt, v);
new_init = reshape_init_r (type, &d, true);
+ if (new_init == error_mark_node)
+ return error_mark_node;
/* Make sure all the element of the constructor were used. Otherwise,
issue an error about exceeding initializers. */
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 533f9fb0a28..99d5d990805 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -1426,7 +1426,7 @@ build_offset_ref (tree type, tree member, bool address_p)
}
error ("invalid use of non-static member function %qD",
TREE_OPERAND (member, 1));
- return member;
+ return error_mark_node;
}
else if (TREE_CODE (member) == FIELD_DECL)
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c0b7c04597d..7277f60936c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,15 @@
+2006-05-31 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/27801
+ * g++.dg/template/cond6.C: New test.
+
+ PR c++/26496
+ * g++.dg/template/crash51.C: New test.
+ * g++.old-deja/g++.mike/net36.C: Tweak error markers.
+
+ PR c++/27385
+ * g++.dg/init/array20.C: New test.
+
2006-05-31 Roger Sayle <roger@eyesopen.com>
* gcc.dg/builtins-54.c: New test case.
diff --git a/gcc/testsuite/g++.dg/init/array20.C b/gcc/testsuite/g++.dg/init/array20.C
new file mode 100644
index 00000000000..06a167596e6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/array20.C
@@ -0,0 +1,5 @@
+// PR c++/27385
+
+struct A {};
+A a[] = { 0 }; // { dg-error "initializer" }
+
diff --git a/gcc/testsuite/g++.dg/template/cond6.C b/gcc/testsuite/g++.dg/template/cond6.C
new file mode 100644
index 00000000000..e4cede35b17
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/cond6.C
@@ -0,0 +1,6 @@
+// PR c++/27801
+
+template<int> int foo(int i)
+{
+ return !( (1 && i) ? 0 : 1 );
+}
diff --git a/gcc/testsuite/g++.dg/template/crash51.C b/gcc/testsuite/g++.dg/template/crash51.C
new file mode 100644
index 00000000000..8c2553d1034
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/crash51.C
@@ -0,0 +1,11 @@
+// PR c++/26496
+
+template< typename _Generator> int generate_n(_Generator __gen);
+struct Distribution { };
+typedef double (Distribution::* Pstd_mem)();
+int main(void)
+{
+ Distribution* rng;
+ Pstd_mem ptr;
+ generate_n(rng->*ptr); // { dg-error "non-static member" }
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/net36.C b/gcc/testsuite/g++.old-deja/g++.mike/net36.C
index 98b38eedb48..3ffa60e37a2 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/net36.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/net36.C
@@ -11,7 +11,7 @@ typedef void (A::*handler) (X*);
class B {
public:
- void setHandler(handler); // { dg-error "candidate" }
+ void setHandler(handler);
};
void f(B* b) {