aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-03-12 01:48:57 -0500
committerJason Merrill <jason@gcc.gnu.org>2011-03-12 01:48:57 -0500
commitba7d31f68a4afe75450273f8e941259b1c676982 (patch)
tree3bf566e1c078c4a15e9b4854b1893db27624da3a /gcc
parent8e71a20690913cec7c3c5c3e9d8c25a61086a0a5 (diff)
downloadgcc-ba7d31f68a4afe75450273f8e941259b1c676982.zip
gcc-ba7d31f68a4afe75450273f8e941259b1c676982.tar.gz
gcc-ba7d31f68a4afe75450273f8e941259b1c676982.tar.bz2
re PR c++/47125 (ICE occurs in combination with partial specialization and invalid template function.)
PR c++/47125 * pt.c (tsubst) [TYPENAME_TYPE]: Only give errors if tf_error. From-SVN: r170896
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/pt.c18
-rw-r--r--gcc/testsuite/ChangeLog2
-rw-r--r--gcc/testsuite/g++.dg/template/error45.C22
4 files changed, 41 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 64281fd..7c1e739 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
2011-03-11 Jason Merrill <jason@redhat.com>
+ PR c++/47125
+ * pt.c (tsubst) [TYPENAME_TYPE]: Only give errors if tf_error.
+
PR c++/47144
* parser.c (cp_parser_template_type_arg): Set
type_definition_forbidden_message.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index ab2aea3..95b82ee 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -10948,11 +10948,21 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
if (TREE_CODE (f) != TYPENAME_TYPE)
{
if (TYPENAME_IS_ENUM_P (t) && TREE_CODE (f) != ENUMERAL_TYPE)
- error ("%qT resolves to %qT, which is not an enumeration type",
- t, f);
+ {
+ if (complain & tf_error)
+ error ("%qT resolves to %qT, which is not an enumeration type",
+ t, f);
+ else
+ return error_mark_node;
+ }
else if (TYPENAME_IS_CLASS_P (t) && !CLASS_TYPE_P (f))
- error ("%qT resolves to %qT, which is is not a class type",
- t, f);
+ {
+ if (complain & tf_error)
+ error ("%qT resolves to %qT, which is is not a class type",
+ t, f);
+ else
+ return error_mark_node;
+ }
}
return cp_build_qualified_type_real
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 5ee1fcd..9652b4aa 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,7 @@
2011-03-11 Jason Merrill <jason@redhat.com>
+ * g++.dg/template/error45.C: New.
+
* g++.dg/parse/no-type-defn1.C: New.
* g++.dg/ext/attrib40.C: New.
diff --git a/gcc/testsuite/g++.dg/template/error45.C b/gcc/testsuite/g++.dg/template/error45.C
new file mode 100644
index 0000000..454acc6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/error45.C
@@ -0,0 +1,22 @@
+// PR c++/47125
+
+template < bool, typename >
+struct enable_if {};
+
+template < typename T >
+struct enable_if< true, T >
+{
+ typedef T type;
+};
+
+template < typename T >
+struct enable_if< true, T >::type
+f( T x );
+
+void
+g( void )
+{
+ f< int >( 0 ); // { dg-error "no match" }
+}
+
+// { dg-prune-output "note" }