Commit e39438c5 by Jason Merrill Committed by Jason Merrill

re PR c++/50298 ([C++0x][constexpr] References cannot be bound to static…

re PR c++/50298 ([C++0x][constexpr] References cannot be bound to static constexpr reference members)

	PR c++/50298
	* parser.c (cp_parser_member_declaration): Don't require a constant
	rvalue here in C++0x.

From-SVN: r178652
parent 30288f9a
2011-09-07 Jason Merrill <jason@redhat.com>
PR c++/50298
* parser.c (cp_parser_member_declaration): Don't require a constant
rvalue here in C++0x.
* pt.c (type_unification_real): Correct complain arg for tsubsting
default template args.
......
......@@ -18187,6 +18187,17 @@ cp_parser_member_declaration (cp_parser* parser)
initializer_token_start = cp_lexer_peek_token (parser->lexer);
if (function_declarator_p (declarator))
initializer = cp_parser_pure_specifier (parser);
else if (cxx_dialect >= cxx0x)
{
bool nonconst;
/* Don't require a constant rvalue in C++11, since we
might want a reference constant. We'll enforce
constancy later. */
cp_lexer_consume_token (parser->lexer);
/* Parse the initializer. */
initializer = cp_parser_initializer_clause (parser,
&nonconst);
}
else
/* Parse the initializer. */
initializer = cp_parser_constant_initializer (parser);
......
2011-09-07 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/constexpr-ref3.C: New.
* g++.dg/cpp0x/sfinae11.C: Check for explanatory diagnostic.
2011-09-07 Georg-Johann Lay <avr@gjlay.de>
......
// PR c++/50298
// { dg-options -std=c++0x }
int global_variable;
template <class T> struct X {
static constexpr T r = global_variable;
};
X<int&> x;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment