diff options
author | Jason Merrill <jason@redhat.com> | 2015-04-14 12:02:41 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2015-04-14 12:02:41 -0400 |
commit | fb899e32c16088cad1a19a3e8df615ecfd1332db (patch) | |
tree | a57c3613c19a2fab37e9e8792a22f3a1abc3fee6 /gcc/cp | |
parent | 0f19e7adef3f2818fd0b363306791c23b0656b62 (diff) | |
download | gcc-fb899e32c16088cad1a19a3e8df615ecfd1332db.zip gcc-fb899e32c16088cad1a19a3e8df615ecfd1332db.tar.gz gcc-fb899e32c16088cad1a19a3e8df615ecfd1332db.tar.bz2 |
re PR c++/65695 (NSDMI calling constexpr constructor with pointer-to-member is not a constant expression)
PR c++/65695
* cvt.c (cp_fold_convert): Avoid wrapping PTRMEM_CST in NOP_EXPR.
From-SVN: r222097
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/cp/cvt.c | 16 |
2 files changed, 17 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 03f6f2a4..3b166a7 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2015-04-14 Jason Merrill <jason@redhat.com> + PR c++/65695 + * cvt.c (cp_fold_convert): Avoid wrapping PTRMEM_CST in NOP_EXPR. + PR c++/65721 * name-lookup.c (do_class_using_decl): Complain about specifying the current class even if there are dependent bases. diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index d0924f1..9aa9006 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -603,8 +603,20 @@ ignore_overflows (tree expr, tree orig) tree cp_fold_convert (tree type, tree expr) { - tree conv = fold_convert (type, expr); - conv = ignore_overflows (conv, expr); + tree conv; + if (TREE_TYPE (expr) == type) + conv = expr; + else if (TREE_CODE (expr) == PTRMEM_CST) + { + /* Avoid wrapping a PTRMEM_CST in NOP_EXPR. */ + conv = copy_node (expr); + TREE_TYPE (conv) = type; + } + else + { + conv = fold_convert (type, expr); + conv = ignore_overflows (conv, expr); + } return conv; } |