mirror of git://gcc.gnu.org/git/gcc.git
re PR c++/65091 (decltype(~arg) fails for template functions)
PR c++/65091 * parser.c (cp_parser_unqualified_id): Don't accept ~x in a template if there is no type x in scope. From-SVN: r225831
This commit is contained in:
parent
49f88e4333
commit
0467e3ebef
|
|
@ -1,3 +1,9 @@
|
||||||
|
2015-07-15 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
|
PR c++/65091
|
||||||
|
* parser.c (cp_parser_unqualified_id): Don't accept ~x in a
|
||||||
|
template if there is no type x in scope.
|
||||||
|
|
||||||
2015-07-14 Patrick Palka <ppalka@gcc.gnu.org>
|
2015-07-14 Patrick Palka <ppalka@gcc.gnu.org>
|
||||||
|
|
||||||
PR c++/66850
|
PR c++/66850
|
||||||
|
|
|
||||||
|
|
@ -5162,8 +5162,15 @@ cp_parser_unqualified_id (cp_parser* parser,
|
||||||
if (processing_template_decl
|
if (processing_template_decl
|
||||||
&& ! cp_parser_parse_definitely (parser))
|
&& ! cp_parser_parse_definitely (parser))
|
||||||
{
|
{
|
||||||
/* We couldn't find a type with this name, so just accept
|
/* We couldn't find a type with this name. If we're parsing
|
||||||
it and check for a match at instantiation time. */
|
tentatively, fail and try something else. */
|
||||||
|
if (cp_parser_uncommitted_to_tentative_parse_p (parser))
|
||||||
|
{
|
||||||
|
cp_parser_simulate_error (parser);
|
||||||
|
return error_mark_node;
|
||||||
|
}
|
||||||
|
/* Otherwise, accept it and check for a match at instantiation
|
||||||
|
time. */
|
||||||
type_decl = cp_parser_identifier (parser);
|
type_decl = cp_parser_identifier (parser);
|
||||||
if (type_decl != error_mark_node)
|
if (type_decl != error_mark_node)
|
||||||
type_decl = build_nt (BIT_NOT_EXPR, type_decl);
|
type_decl = build_nt (BIT_NOT_EXPR, type_decl);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
// PR c++/65091
|
||||||
|
// { dg-do compile { target c++11 } }
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
auto foo(T x) -> decltype(~x) {
|
||||||
|
return ~x;
|
||||||
|
}
|
||||||
|
|
||||||
|
int bar() {
|
||||||
|
return foo(10);
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue