Skip to content
Snippets Groups Projects
Commit 3775f71c authored by Jason Merrill's avatar Jason Merrill
Browse files

c++: support C++11 attributes in C++98

I don't see any reason why we can't allow the [[]] attribute syntax in C++98
mode with a pedwarn just like many other C++11 features.  In fact, we
already do support it in some places in the grammar, but not in places that
check cp_nth_tokens_can_be_std_attribute_p.

Let's also follow the C front-end's lead in only warning about them when
-pedantic.

It still isn't necessary for this function to guard against Objective-C
message passing syntax; we handle that with tentative parsing in
cp_parser_statement, and we don't call this function in that context anyway.

gcc/cp/ChangeLog:

	* parser.cc (cp_nth_tokens_can_be_std_attribute_p): Don't check
	cxx_dialect.
	* error.cc (maybe_warn_cpp0x): Only complain about C++11 attributes
	if pedantic.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/gen-attrs-1.C: Also run in C++98 mode.
	* g++.dg/cpp0x/gen-attrs-11.C: Likewise.
	* g++.dg/cpp0x/gen-attrs-13.C: Likewise.
	* g++.dg/cpp0x/gen-attrs-15.C: Likewise.
	* g++.dg/cpp0x/gen-attrs-75.C: Don't expect C++98 warning after
	__extension__.
parent 1fad396d
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment