]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/23841 (Floating-point literals cast to integral types should be accepted...
authorMark Mitchell <mark@codesourcery.com>
Tue, 13 Sep 2005 02:41:07 +0000 (02:41 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Tue, 13 Sep 2005 02:41:07 +0000 (02:41 +0000)
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

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/parse/template17.C [new file with mode: 0644]

index 6ce6f5fd1f78704b803530ca26e6f411363fdc84..cd19181dafc02c1d4bff6df2b8f60cb66b39160d 100644 (file)
@@ -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
index a8a2c4963e7b6ecab8676343bc69003aedb609f4..0f8d17cd5040beaee6c34e259866ba21a806d187 100644 (file)
@@ -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;
            }
 
index 9678760d8a659c5ff1575eb48f05d345361f157f..26919da7139c3353500f51f6527efb074fcce5b4 100644 (file)
@@ -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
diff --git a/gcc/testsuite/g++.dg/parse/template17.C b/gcc/testsuite/g++.dg/parse/template17.C
new file mode 100644 (file)
index 0000000..ade598d
--- /dev/null
@@ -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;
+}