]> gcc.gnu.org Git - gcc.git/blobdiff - gcc/cp/typeck2.c
typeck2.c (add_exception_specifier): Only require complete type if not in processing...
[gcc.git] / gcc / cp / typeck2.c
index 1538944ab5cecdcf9815fffaaaee22368e37d876..5ba46111cc06a4bf3bf0ebd16f3be800552f24be 100644 (file)
@@ -38,6 +38,7 @@ Boston, MA 02111-1307, USA.  */
 #include "flags.h"
 #include "toplev.h"
 #include "output.h"
+#include "diagnostic.h"
 
 static tree process_init_constructor PARAMS ((tree, tree, tree *));
 
@@ -470,6 +471,11 @@ digest_init (type, init, tail)
                                  && TREE_VALUE (init) == error_mark_node))
     return error_mark_node;
 
+  if (TREE_CODE (init) == ERROR_MARK)
+    /* __PRETTY_FUNCTION__'s initializer is a bogus expression inside
+       a template function. This gets substituted during instantiation. */
+    return init;
+  
   /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue.  */
   if (TREE_CODE (init) == NON_LVALUE_EXPR)
     init = TREE_OPERAND (init, 0);
@@ -1058,7 +1064,7 @@ build_x_arrow (datum)
     last_rval = default_conversion (rval);
 
   if (TREE_CODE (TREE_TYPE (last_rval)) == POINTER_TYPE)
-    return build_indirect_ref (last_rval, NULL_PTR);
+    return build_indirect_ref (last_rval, NULL);
 
   if (types_memoized)
     error ("result of `operator->()' yields non-pointer result");
@@ -1093,6 +1099,10 @@ build_m_component_ref (datum, component)
     return build_min_nt (DOTSTAR_EXPR, datum, component);
 
   datum = decay_conversion (datum);
+
+  if (datum == error_mark_node || component == error_mark_node)
+    return error_mark_node;
+
   objtype = TYPE_MAIN_VARIANT (TREE_TYPE (datum));  
 
   if (TYPE_PTRMEMFUNC_P (TREE_TYPE (component)))
@@ -1100,18 +1110,15 @@ build_m_component_ref (datum, component)
       type = TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (TREE_TYPE (component)));
       field_type = type;
     }
-  else
+  else if (TYPE_PTRMEM_P (TREE_TYPE (component)))
     {
       type = TREE_TYPE (TREE_TYPE (component));
       field_type = TREE_TYPE (type);
     }
-
-  if (datum == error_mark_node || component == error_mark_node)
-    return error_mark_node;
-
-  if (TREE_CODE (type) != OFFSET_TYPE && TREE_CODE (type) != METHOD_TYPE)
+  else
     {
-      cp_error ("`%E' cannot be used as a member pointer, since it is of type `%T'", component, type);
+      cp_error ("`%E' cannot be used as a member pointer, since it is of type `%T'", 
+               component, TREE_TYPE (component));
       return error_mark_node;
     }
 
@@ -1286,9 +1293,11 @@ add_exception_specifier (list, spec, complain)
     ok = is_ptr;
   else if (TREE_CODE (core) == TEMPLATE_TYPE_PARM)
     ok = 1;
+  else if (processing_template_decl)
+    ok = 1;
   else
     ok = COMPLETE_TYPE_P (complete_type (core));
-  
+
   if (ok)
     {
       tree probe;
This page took 0.031052 seconds and 5 git commands to generate.