From d08fd9d6a3ba7908c0ca617706d27fda1929d5d1 Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Fri, 21 Oct 2005 16:03:47 +0000 Subject: [PATCH] re PR c++/24260 (stdcall attribute is ignored at static member template functions) 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 | 6 ++++++ gcc/cp/parser.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/ext/tmplattr1.C | 24 ++++++++++++++++++++++++ 4 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/ext/tmplattr1.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index bba2e8e94f0e..dee7410600df 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2005-10-21 Mark Mitchell + + PR c++/24260 + * parser.c (cp_parser_init_declarator): Pass attributes to + grokfield. + 2005-10-20 Mark Mitchell PR c++/22618 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 300c266da9e1..25f25ce69ec6 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -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); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index af14116ef71f..1f3dd7a519df 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-10-21 Mark Mitchell + + PR c++/24260 + * g++.dg/ext/tmplattr1.C: New test. + 2005-10-21 Paul Thomas 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 index 000000000000..111e3441fbc5 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/tmplattr1.C @@ -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 + static int stdcall func(int arg1, int arg2); +}; + +template +int stdcall T::func(int arg1, int arg2) +{ + return arg1+arg2; +} + +struct dummy {}; + +void xx() +{ + int (stdcall *ptr2)(int,int) = &T::func; +} +