In gcc/cp/: 2011-06-06 Nicola Pero <nicola.pero@meta-innovation.com>,

In gcc/cp/:
2011-06-06  Nicola Pero  <nicola.pero@meta-innovation.com>,

	PR obj-c++/48275
	* parser.c (cp_parser_objc_at_property_declaration): Allow setter
	and getter names to use all the allowed method names.

In gcc/testsuite/:
2011-06-06  Nicola Pero  <nicola.pero@meta-innovation.com>

	PR objc-++/48275
	* obj-c++.dg/property/cxx-property-1.mm: New.	
	* obj-c++.dg/property/cxx-property-2.mm: New.

From-SVN: r174726
This commit is contained in:
Nicola Pero 2011-06-06 22:09:47 +00:00
parent a651bcbe5e
commit 889ec77132
5 changed files with 55 additions and 7 deletions

View File

@ -1,3 +1,9 @@
2011-06-06 Nicola Pero <nicola.pero@meta-innovation.com>,
PR obj-c++/48275
* parser.c (cp_parser_objc_at_property_declaration): Allow setter
and getter names to use all the allowed method names.
2011-06-06 Jason Merrill <jason@redhat.com>
PR c++/49298

View File

@ -23187,7 +23187,7 @@ cp_parser_objc_at_property_declaration (cp_parser *parser)
break;
}
cp_lexer_consume_token (parser->lexer); /* eat the = */
if (cp_lexer_next_token_is_not (parser->lexer, CPP_NAME))
if (!cp_parser_objc_selector_p (cp_lexer_peek_token (parser->lexer)->type))
{
cp_parser_error (parser, "expected identifier");
syntax_error = true;
@ -23196,10 +23196,12 @@ cp_parser_objc_at_property_declaration (cp_parser *parser)
if (keyword == RID_SETTER)
{
if (property_setter_ident != NULL_TREE)
cp_parser_error (parser, "the %<setter%> attribute may only be specified once");
{
cp_parser_error (parser, "the %<setter%> attribute may only be specified once");
cp_lexer_consume_token (parser->lexer);
}
else
property_setter_ident = cp_lexer_peek_token (parser->lexer)->u.value;
cp_lexer_consume_token (parser->lexer);
property_setter_ident = cp_parser_objc_selector (parser);
if (cp_lexer_next_token_is_not (parser->lexer, CPP_COLON))
cp_parser_error (parser, "setter name must terminate with %<:%>");
else
@ -23208,10 +23210,12 @@ cp_parser_objc_at_property_declaration (cp_parser *parser)
else
{
if (property_getter_ident != NULL_TREE)
cp_parser_error (parser, "the %<getter%> attribute may only be specified once");
{
cp_parser_error (parser, "the %<getter%> attribute may only be specified once");
cp_lexer_consume_token (parser->lexer);
}
else
property_getter_ident = cp_lexer_peek_token (parser->lexer)->u.value;
cp_lexer_consume_token (parser->lexer);
property_getter_ident = cp_parser_objc_selector (parser);
}
break;
default:

View File

@ -1,3 +1,9 @@
2011-06-06 Nicola Pero <nicola.pero@meta-innovation.com>
PR objc-++/48275
* obj-c++.dg/property/cxx-property-1.mm: New.
* obj-c++.dg/property/cxx-property-2.mm: New.
2011-06-06 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/regress/ptrmem1.C: New.

View File

@ -0,0 +1,10 @@
/* Testcase from PR obj-c++/48275. */
/* { dg-do compile } */
@interface Test
{
int ns;
}
@property (getter=namespace) int ns;
@end

View File

@ -0,0 +1,22 @@
/* { dg-do compile } */
/* All these C++ keywords are acceptable in ObjC method names, hence
should be accepted for property getters and setters. */
@interface Test
{
Class isa;
}
@property (getter=namespace) int p0;
@property (setter=namespace:) int p1;
@property (getter=and) int p2;
@property (setter=and:) int p3;
@property (getter=class) int p4;
@property (setter=class:) int p5;
@property (getter=new) int p6;
@property (setter=new:) int p7;
@property (getter=delete) int p8;
@property (setter=delete:) int p9;
@property (getter=delete) int p10;
@property (setter=delete:) int p11;
@end