diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0769847be94..cd750942731 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2013-10-03 Easwaran Raman + + PR c++/33911 + * parser.c (cp_parser_init_declarator): Do not drop attributes + of template member functions. + 2013-10-03 Marek Polacek PR c++/58510 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index d0a23f3c3b8..42b4e60219e 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -16548,7 +16548,7 @@ cp_parser_init_declarator (cp_parser* parser, decl = grokfield (declarator, decl_specifiers, initializer, !is_non_constant_init, /*asmspec=*/NULL_TREE, - prefix_attributes); + chainon (attributes, 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 6e4a4e47321..b423b92620a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-10-03 Easwaran Raman + + PR c++/33911 + * g++.dg/ext/attribute47.C: New. + 2013-10-03 Marek Polacek PR c++/58510 diff --git a/gcc/testsuite/g++.dg/ext/attrib47.C b/gcc/testsuite/g++.dg/ext/attrib47.C new file mode 100644 index 00000000000..22f49084bcc --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/attrib47.C @@ -0,0 +1,21 @@ +// { dg-do compile } +// { dg-options "-O2" } + +class A +{ + public: + template + T foo(T a) __attribute__ ((noinline)); +}; + +template + T A::foo(T a) + { + return a+1; + } + +int bar(A a) { + return a.foo(1); +} + +// { dg-final { scan-assembler "_ZN1A3fooIiEET_S1_" } }