From 4414e22eeeaaf9dbd41f182173aa0a23ee792d1a Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Tue, 17 Feb 2015 08:25:30 +0000 Subject: [PATCH] re PR c++/65075 (constexpr regression) PR c++/65075 * constexpr.c (check_constexpr_bind_expr_vars): Allow implicit typedefs for lambda types. * g++.dg/cpp0x/pr65075.C: New test. Co-Authored-By: Jakub Jelinek From-SVN: r220748 --- gcc/cp/ChangeLog | 7 +++++++ gcc/cp/constexpr.c | 3 ++- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/g++.dg/cpp0x/pr65075.C | 17 +++++++++++++++++ 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr65075.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6d21c286686..115a9f3700a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2015-02-17 Paolo Carlini + Jakub Jelinek + + PR c++/65075 + * constexpr.c (check_constexpr_bind_expr_vars): Allow + implicit typedefs for lambda types. + 2015-02-13 Paolo Carlini PR c++/60894 diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index d415dd4e6d2..32a23ff7380 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -416,7 +416,8 @@ check_constexpr_bind_expr_vars (tree t) for (tree var = BIND_EXPR_VARS (t); var; var = DECL_CHAIN (var)) if (TREE_CODE (var) == TYPE_DECL - && DECL_IMPLICIT_TYPEDEF_P (var)) + && DECL_IMPLICIT_TYPEDEF_P (var) + && !LAMBDA_TYPE_P (TREE_TYPE (var))) return false; return true; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ee133fa2bc0..ba21ab446bf 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2015-02-17 Paolo Carlini + Jakub Jelinek + + PR c++/65075 + * g++.dg/cpp0x/pr65075.C: New test. + 2015-02-16 David Edelsohn PR target/65058 diff --git a/gcc/testsuite/g++.dg/cpp0x/pr65075.C b/gcc/testsuite/g++.dg/cpp0x/pr65075.C new file mode 100644 index 00000000000..7d953ff6469 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr65075.C @@ -0,0 +1,17 @@ +// PR c++/65075 +// { dg-do compile { target c++11 } } + +typedef void (*E) (); +template +constexpr E +bar (bool a) +{ + return a ? []() {} : []() {}; +} + +void +foo () +{ + (bar (false)) (); + (bar (true)) (); +} -- 2.30.2