re PR c++/57771 (g++ misinterprets >> in static_cast)
PR c++/57771 * parser.c (cp_parser_postfix_expression) <case RID_STATCAST> Temporarily set parser->greater_than_is_operator_p for cp_parser_expression and restore from saved value afterwards. * g++.dg/template/arg9.C: New test. From-SVN: r200647
This commit is contained in:
parent
e90d156864
commit
2febd8772b
4 changed files with 27 additions and 0 deletions
|
@ -1,3 +1,10 @@
|
|||
2013-07-03 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/57771
|
||||
* parser.c (cp_parser_postfix_expression) <case RID_STATCAST>
|
||||
Temporarily set parser->greater_than_is_operator_p for
|
||||
cp_parser_expression and restore from saved value afterwards.
|
||||
|
||||
2013-06-28 Ed Smith-Rowland <3dw4rd@verizon.net>
|
||||
|
||||
* cp-tree.h (UDLIT_OP_ANSI_PREFIX): Remove space.
|
||||
|
|
|
@ -5576,11 +5576,18 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p,
|
|||
/* Restore the old message. */
|
||||
parser->type_definition_forbidden_message = saved_message;
|
||||
|
||||
bool saved_greater_than_is_operator_p
|
||||
= parser->greater_than_is_operator_p;
|
||||
parser->greater_than_is_operator_p = true;
|
||||
|
||||
/* And the expression which is being cast. */
|
||||
cp_parser_require (parser, CPP_OPEN_PAREN, RT_OPEN_PAREN);
|
||||
expression = cp_parser_expression (parser, /*cast_p=*/true, & idk);
|
||||
cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN);
|
||||
|
||||
parser->greater_than_is_operator_p
|
||||
= saved_greater_than_is_operator_p;
|
||||
|
||||
/* Only type conversions to integral or enumeration types
|
||||
can be used in constant-expressions. */
|
||||
if (!cast_valid_in_integral_constant_expression_p (type)
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2013-07-03 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/57771
|
||||
* g++.dg/template/arg9.C: New test.
|
||||
|
||||
2013-07-02 Sriraman Tallam <tmsriram@google.com>
|
||||
|
||||
* gcc.target/i386/avx-inline.c: New test.
|
||||
|
|
8
gcc/testsuite/g++.dg/template/arg9.C
Normal file
8
gcc/testsuite/g++.dg/template/arg9.C
Normal file
|
@ -0,0 +1,8 @@
|
|||
// PR c++/57771
|
||||
// { dg-do compile }
|
||||
|
||||
template <int N>
|
||||
struct S {};
|
||||
|
||||
S <static_cast <int> (4>>2)> s1;
|
||||
S <reinterpret_cast <int> (4>>2)> s2;
|
Loading…
Add table
Reference in a new issue