re PR c++/23841 (Floating-point literals cast to integral types should be accepted in integer constant expressions)
PR c++/23841 * parser.c (cp_parser_primary_expression): Recognize the closing ">" of a template-argument-list after a floating-point literal as the end of a cast expression. PR c++/23841 * g++.dg/parse/template17.C: New test. From-SVN: r104208
This commit is contained in:
parent
2eef28ec7b
commit
060e73279b
4 changed files with 29 additions and 1 deletions
|
@ -1,3 +1,10 @@
|
|||
2005-09-12 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/23841
|
||||
* parser.c (cp_parser_primary_expression): Recognize the closing
|
||||
">" of a template-argument-list after a floating-point literal as
|
||||
the end of a cast expression.
|
||||
|
||||
2005-09-12 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/23789
|
||||
|
|
|
@ -2779,7 +2779,10 @@ cp_parser_primary_expression (cp_parser *parser,
|
|||
/* The end of the cast-expression. */
|
||||
&& next_token->type != CPP_CLOSE_PAREN
|
||||
/* The end of an array bound. */
|
||||
&& next_token->type != CPP_CLOSE_SQUARE)
|
||||
&& next_token->type != CPP_CLOSE_SQUARE
|
||||
/* The closing ">" in a template-argument-list. */
|
||||
&& (next_token->type != CPP_GREATER
|
||||
|| parser->greater_than_is_operator_p))
|
||||
cast_p = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2005-09-12 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/23841
|
||||
* g++.dg/parse/template17.C: New test.
|
||||
|
||||
2005-09-12 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/23789
|
||||
|
|
13
gcc/testsuite/g++.dg/parse/template17.C
Normal file
13
gcc/testsuite/g++.dg/parse/template17.C
Normal file
|
@ -0,0 +1,13 @@
|
|||
// PR c++/23841
|
||||
|
||||
template <int I>
|
||||
struct S
|
||||
{
|
||||
int f(int i = I) { return i; }
|
||||
};
|
||||
|
||||
void
|
||||
g ()
|
||||
{
|
||||
S<(int)0.> a2;
|
||||
}
|
Loading…
Add table
Reference in a new issue