diff options
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/pt.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ext/stmtexpr14.C | 12 |
4 files changed, 28 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 63d8f2f..978df51 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2012-01-12 Jason Merrill <jason@redhat.com> + + PR c++/51714 + * pt.c (value_dependent_expression_p): Treat STMT_EXPR as + value-dependent. + 2012-01-13 Dodji Seketeli <dodji@redhat.com> PR c++/51633 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 97a9294..f2b4c8e 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -19526,6 +19526,11 @@ value_dependent_expression_p (tree expression) return false; } + case STMT_EXPR: + /* Treat a GNU statement expression as dependent to avoid crashing + under fold_non_dependent_expr; it can't be constant. */ + return true; + default: /* A constant expression is value-dependent if any subexpression is value-dependent. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a4b09ea..fe1d559 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-01-12 Jason Merrill <jason@redhat.com> + + PR c++/51714 + * g++.dg/ext/stmtexpr14.C: New. + 2012-01-13 Dodji Seketeli <dodji@redhat.com> PR c++/51633 diff --git a/gcc/testsuite/g++.dg/ext/stmtexpr14.C b/gcc/testsuite/g++.dg/ext/stmtexpr14.C new file mode 100644 index 0000000..5f3ff0d --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/stmtexpr14.C @@ -0,0 +1,12 @@ +// PR c++/51714 + +template <typename T> +void Foo() +{ + true || !__extension__ ({ int verbose = 2; verbose <= 3; }); +} + +int main() +{ + Foo<int>(); +} |