PR c++/67504
* parser.c (cp_parser_omp_clause_collapse): Test tree_fits_shwi_p
before INTEGRAL_TYPE_P test.
* g++.dg/gomp/pr67504.C: New test.
From-SVN: r227579
+2015-09-09 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/67504
+ * parser.c (cp_parser_omp_clause_collapse): Test tree_fits_shwi_p
+ before INTEGRAL_TYPE_P test.
+
2015-09-08 Jason Merrill <jason@redhat.com>
PR c++/67041
if (num == error_mark_node)
return list;
num = fold_non_dependent_expr (num);
- if (!INTEGRAL_TYPE_P (TREE_TYPE (num))
- || !tree_fits_shwi_p (num)
+ if (!tree_fits_shwi_p (num)
+ || !INTEGRAL_TYPE_P (TREE_TYPE (num))
|| (n = tree_to_shwi (num)) <= 0
|| (int) n != n)
{
2015-09-09 Jakub Jelinek <jakub@redhat.com>
+ PR c++/67504
+ * g++.dg/gomp/pr67504.C: New test.
+
PR c/67501
* c-c++-common/gomp/pr67501.c: New test.
--- /dev/null
+// PR c++/67504
+// { dg-do compile }
+// { dg-options "-fopenmp" }
+
+int bar (int);
+double bar (double);
+
+template <typename T>
+void
+foo (T x)
+{
+ #pragma omp for collapse (x + 1) // { dg-error "collapse argument needs positive constant integer expression" }
+ for (int i = 0; i < 10; i++)
+ ;
+}