diff options
author | Jason Merrill <jason@redhat.com> | 2018-06-03 08:37:03 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2018-06-03 08:37:03 -0400 |
commit | c5f50290c75bb22dc4458f4cc88c8b03c22640ca (patch) | |
tree | 803bf5b802bf5e557b91ef68a3dee68099ddd34e | |
parent | c14add82fa4ec24a09e48d56094d9f46310f0809 (diff) | |
download | gcc-c5f50290c75bb22dc4458f4cc88c8b03c22640ca.zip gcc-c5f50290c75bb22dc4458f4cc88c8b03c22640ca.tar.gz gcc-c5f50290c75bb22dc4458f4cc88c8b03c22640ca.tar.bz2 |
PR c++/85739 - ICE with pointer to member template parm.
* cvt.c (perform_qualification_conversions): Use cp_fold_convert.
From-SVN: r261129
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/cvt.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/ptrmem32.C | 10 |
3 files changed, 18 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c661d46..5d4cacc 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2018-06-03 Jason Merrill <jason@redhat.com> + + PR c++/85739 - ICE with pointer to member template parm. + * cvt.c (perform_qualification_conversions): Use cp_fold_convert. + 2018-06-02 Jason Merrill <jason@redhat.com> PR c++/85761 - ICE with ill-formed use of const outer variable. diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index f29dacd..bca9d05 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -1945,7 +1945,8 @@ can_convert_qual (tree type, tree expr) /* Attempt to perform qualification conversions on EXPR to convert it to TYPE. Return the resulting expression, or error_mark_node if - the conversion was impossible. */ + the conversion was impossible. Since this is only used by + convert_nontype_argument, we fold the conversion. */ tree perform_qualification_conversions (tree type, tree expr) @@ -1957,7 +1958,7 @@ perform_qualification_conversions (tree type, tree expr) if (same_type_p (type, expr_type)) return expr; else if (can_convert_qual (type, expr)) - return build_nop (type, expr); + return cp_fold_convert (type, expr); else return error_mark_node; } diff --git a/gcc/testsuite/g++.dg/template/ptrmem32.C b/gcc/testsuite/g++.dg/template/ptrmem32.C new file mode 100644 index 0000000..edf2003 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/ptrmem32.C @@ -0,0 +1,10 @@ +// PR c++/85739 + +struct l { int k; }; +template <int l::*> class b { }; +template <const int l::*> class B { typedef int e; }; +template <int l::*i, const int l::*n> +bool operator!=(B<n>, b<i>); + +bool bb = (B<&l::k>() != b<&l::k>()); + |