pt.c (push_template_decl_real): Don't remangle the name of a class template.
authorMark Mitchell <mark@codesourcery.com>
Fri, 16 Feb 2001 08:03:23 +0000 (08:03 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Fri, 16 Feb 2001 08:03:23 +0000 (08:03 +0000)
* pt.c (push_template_decl_real): Don't remangle the name of a
class template.

From-SVN: r39753

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/g++.old-deja/g++.other/asm2.C [new file with mode: 0644]

index a4413a97e8a9865579e6c55728a8924ede048af7..2a8d7a56335866dd791f4603719a421e5127875f 100644 (file)
@@ -1,3 +1,7 @@
+2001-02-16  Mark Mitchell  <mark@codesourcery.com>
+
+       * semantics.c (finish_asm_stmt): Robustify.
+
 2001-02-15  Mark Mitchell  <mark@codesourcery.com>
 
        * pt.c (push_template_decl_real): Don't remangle the name of a
index c5bbe1be604ca27f20d019f39189f6823667d924..9bd7ff71d67f8285de383c5aad4c37b14f4919f3 100644 (file)
@@ -912,7 +912,22 @@ finish_asm_stmt (cv_qualifier, string, output_operands,
 
   if (!processing_template_decl)
     for (t = input_operands; t; t = TREE_CHAIN (t))
-      TREE_VALUE (t) = decay_conversion (TREE_VALUE (t));
+      {
+       tree converted_operand 
+         = decay_conversion (TREE_VALUE (t)); 
+
+       /* If the type of the operand hasn't been determined (e.g.,
+          because it involves an overloaded function), then issue an
+          error message.  There's no context available to resolve the
+          overloading.  */
+       if (TREE_TYPE (converted_operand) == unknown_type_node)
+         {
+           cp_error ("type of asm operand `%E' could not be determined", 
+                     TREE_VALUE (t));
+           converted_operand = error_mark_node;
+         }
+       TREE_VALUE (t) = converted_operand;
+      }
 
   r = build_stmt (ASM_STMT, cv_qualifier, string,
                  output_operands, input_operands,
diff --git a/gcc/testsuite/g++.old-deja/g++.other/asm2.C b/gcc/testsuite/g++.old-deja/g++.other/asm2.C
new file mode 100644 (file)
index 0000000..6a96504
--- /dev/null
@@ -0,0 +1,12 @@
+// Build don't link:
+// Origin: Mark Mitchell <mark@codesourcery.com>
+
+struct C
+{
+  void f ();
+};
+
+void C::f ()
+{
+  asm ("" : : "m" (f)); // ERROR - type could not be determined
+}