Bug 60765 - Function attributes ignored for pointer-to-member-function parameters
Summary: Function attributes ignored for pointer-to-member-function parameters
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.9.0
: P3 normal
Target Milestone: 5.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-04 23:11 UTC by patrick
Modified: 2014-04-16 20:19 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description patrick 2014-04-04 23:11:15 UTC
$ cat this.cc
struct Foo;

void foo (int& (Foo::*) () __attribute__ ((returns_nonnull)));
$ g++ this.cc -c
this.cc:4:55: warning: ‘returns_nonnull’ attribute directive ignored [-Wattributes]
 foo (int& (Foo::*) () __attribute__ ((returns_nonnull)));
                                                       ^
Comment 1 patrick 2014-04-04 23:18:06 UTC
Oops, that warning is because I am currently compiling with G++ 4.8, which doesn't implement returns_nonnull.  Here's a better test case:

$ cat this.cc
struct Foo;

void foo (void (Foo::*) () __attribute__ ((nonnull)));
void bar (void (*) () __attribute__ ((nonnull)));

$ g++ this.cc c
this.cc:3:52: warning: ‘nonnull’ attribute only applies to function types [-Wattributes]
 void foo (void (Foo::*) () __attribute__ ((nonnull)));
                                                    ^
Comment 2 patrick 2014-04-04 23:23:16 UTC
I will try to resolve this.
Comment 3 paolo@gcc.gnu.org 2014-04-16 20:18:18 UTC
Author: paolo
Date: Wed Apr 16 20:17:46 2014
New Revision: 209447

URL: http://gcc.gnu.org/viewcvs?rev=209447&root=gcc&view=rev
Log:
2014-04-16  Patrick Palka  <patrick@parcs.ath.cx>

	PR c++/60765
	* decl2.c (cplus_decl_attributes): Handle
	pointer-to-member-function declarations.

2014-04-16  Patrick Palka  <patrick@parcs.ath.cx>

	PR c++/60764
	* call.c (build_user_type_coversion): Use build_dummy_object
	to create the placeholder object for a constructor method call.
	(build_special_member_call): Likewise.
	(build_over_call): Check for the placeholder object with
	is_dummy_object.
	(build_new_method_call_1): Likewise.  Don't attempt to resolve
	a dummy object for a constructor method call.

Added:
    trunk/gcc/testsuite/g++.dg/ext/attrib49.C
    trunk/gcc/testsuite/g++.dg/warn/nonnull2.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/call.c
    trunk/gcc/cp/decl2.c
    trunk/gcc/testsuite/g++.dg/cpp0x/gen-attrs-36-1.C
Comment 4 Paolo Carlini 2014-04-16 20:19:41 UTC
Fixed.