decl2.c (grokfield): Don't accept `asm' specifiers for non-static data members.
authorMark Mitchell <mark@codesourcery.com>
Mon, 8 Jan 2001 01:58:54 +0000 (01:58 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Mon, 8 Jan 2001 01:58:54 +0000 (01:58 +0000)
* decl2.c (grokfield): Don't accept `asm' specifiers for
non-static data members.

From-SVN: r38792

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

index 0f4277fad319bc3f87fcc375da5f58d80e4ab370..0f4e41c18a513fd0ed288ab460d7daa9f38a6d64 100644 (file)
@@ -1,3 +1,8 @@
+2001-01-07  Mark Mitchell  <mark@codesourcery.com>
+
+       * decl2.c (grokfield): Don't accept `asm' specifiers for
+       non-static data members.
+
 2001-01-07  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * expr.c (cplus_expand_expr): Don't reset `target'.
index bac8a6d4f241e86c9025b1dbc1149fb9613e0088..a8269c28f0f5b879e8cac2a56c4988947343c009 100644 (file)
@@ -1794,15 +1794,10 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
   if (TREE_CODE (value) == FIELD_DECL)
     {
       if (asmspec)
-       {
-         /* This must override the asm specifier which was placed
-            by grokclassfn.  Lay this out fresh.  */
-         DECL_RTL (value) = NULL_RTX;
-         DECL_ASSEMBLER_NAME (value) = get_identifier (asmspec);
-       }
+       cp_error ("`asm' specifiers are not permitted on non-static data members");
       if (DECL_INITIAL (value) == error_mark_node)
        init = error_mark_node;
-      cp_finish_decl (value, init, asmspec_tree, flags);
+      cp_finish_decl (value, init, NULL_TREE, flags);
       DECL_INITIAL (value) = init;
       DECL_IN_AGGR_P (value) = 1;
       return value;
diff --git a/gcc/testsuite/g++.old-deja/g++.other/asm1.C b/gcc/testsuite/g++.old-deja/g++.other/asm1.C
new file mode 100644 (file)
index 0000000..b7065d7
--- /dev/null
@@ -0,0 +1,6 @@
+// Build don't link:
+// Origin: Mark Mitchell <mark@codesourcery.com>
+
+struct S {
+  int i asm ("abc"); // ERROR - `asm' specifier not permitted 
+};