re PR c++/24260 (stdcall attribute is ignored at static member template functions)
authorMark Mitchell <mark@codesourcery.com>
Fri, 21 Oct 2005 16:03:47 +0000 (16:03 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Fri, 21 Oct 2005 16:03:47 +0000 (16:03 +0000)
PR c++/24260
* parser.c (cp_parser_init_declarator): Pass attributes to
grokfield.
PR c++/24260
* g++.dg/ext/tmplattr1.C: New test.

From-SVN: r105746

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/tmplattr1.C [new file with mode: 0644]

index bba2e8e94f0e78d8f2a3d9ef18a8a989f20ac698..dee7410600dfbdd78015cf2918446c1f21a803f2 100644 (file)
@@ -1,3 +1,9 @@
+2005-10-21  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/24260
+       * parser.c (cp_parser_init_declarator): Pass attributes to
+       grokfield. 
+
 2005-10-20  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/22618
index 300c266da9e1f07c0fbf70440e9be111538bd624..25f25ce69ec67ebe5f49d4f7e200ba7a0fe02a28 100644 (file)
@@ -10938,7 +10938,7 @@ cp_parser_init_declarator (cp_parser* parser,
        }
       decl = grokfield (declarator, decl_specifiers,
                        initializer, /*asmspec=*/NULL_TREE,
-                       /*attributes=*/NULL_TREE);
+                       prefix_attributes);
       if (decl && TREE_CODE (decl) == FUNCTION_DECL)
        cp_parser_save_default_args (parser, decl);
     }
index af14116ef71fc19e178fe5e1b086aafc28db06d1..1f3dd7a519dfd31987fce3bc97c39b7018aea8d0 100644 (file)
@@ -1,3 +1,8 @@
+2005-10-21  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/24260
+       * g++.dg/ext/tmplattr1.C: New test.
+
 2005-10-21  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/24440
diff --git a/gcc/testsuite/g++.dg/ext/tmplattr1.C b/gcc/testsuite/g++.dg/ext/tmplattr1.C
new file mode 100644 (file)
index 0000000..111e344
--- /dev/null
@@ -0,0 +1,24 @@
+// PR c++/24260
+// { dg-do compile { target i?86-*-* x86_64-*-* } }
+// { dg-require-effective-target ilp32 }
+
+#define stdcall __attribute__((stdcall))
+
+struct T {
+  template <class S>
+  static int stdcall func(int arg1, int arg2);
+};
+
+template <class S>
+int stdcall T::func(int arg1, int arg2)
+{
+  return arg1+arg2;
+}
+
+struct dummy {};
+
+void xx()
+{
+  int (stdcall *ptr2)(int,int) = &T::func<dummy>;
+}
+