PR c++/89212 - ICE converting nullptr to pointer-to-member-function.
* pt.c (tsubst_copy_and_build) <case CONSTRUCTOR>: Return early for null member pointer value. * g++.dg/cpp0x/nullptr40.C: New test. * g++.dg/cpp0x/nullptr41.C: New test. From-SVN: r268781
This commit is contained in:
parent
75c5639de1
commit
ab97c3cdaf
5 changed files with 56 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
|||
2019-02-11 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
PR c++/89212 - ICE converting nullptr to pointer-to-member-function.
|
||||
* pt.c (tsubst_copy_and_build) <case CONSTRUCTOR>: Return early for
|
||||
null member pointer value.
|
||||
|
||||
2019-02-11 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/88977
|
||||
|
|
|
@ -19253,6 +19253,12 @@ tsubst_copy_and_build (tree t,
|
|||
looked up by digest_init. */
|
||||
process_index_p = !(type && MAYBE_CLASS_TYPE_P (type));
|
||||
|
||||
if (null_member_pointer_value_p (t))
|
||||
{
|
||||
gcc_assert (same_type_p (type, TREE_TYPE (t)));
|
||||
RETURN (t);
|
||||
}
|
||||
|
||||
n = vec_safe_copy (CONSTRUCTOR_ELTS (t));
|
||||
newlen = vec_safe_length (n);
|
||||
FOR_EACH_VEC_SAFE_ELT (n, idx, ce)
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2019-02-11 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
PR c++/89212 - ICE converting nullptr to pointer-to-member-function.
|
||||
* g++.dg/cpp0x/nullptr40.C: New test.
|
||||
* g++.dg/cpp0x/nullptr41.C: New test.
|
||||
|
||||
2019-02-11 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/88977
|
||||
|
|
19
gcc/testsuite/g++.dg/cpp0x/nullptr40.C
Normal file
19
gcc/testsuite/g++.dg/cpp0x/nullptr40.C
Normal file
|
@ -0,0 +1,19 @@
|
|||
// PR c++/89212
|
||||
// { dg-do compile { target c++11 } }
|
||||
|
||||
template <int, typename T> using enable_if_t = int;
|
||||
|
||||
template<class X, void(X::*foo)() = nullptr>
|
||||
struct p
|
||||
{
|
||||
template<void(X::*fun)() = foo, typename T = enable_if_t<nullptr == fun, int>>
|
||||
p(T) { }
|
||||
p() = default;
|
||||
};
|
||||
|
||||
struct A
|
||||
{
|
||||
p<A> i = 1;
|
||||
void bar();
|
||||
p<A, &A::bar> j;
|
||||
};
|
19
gcc/testsuite/g++.dg/cpp0x/nullptr41.C
Normal file
19
gcc/testsuite/g++.dg/cpp0x/nullptr41.C
Normal file
|
@ -0,0 +1,19 @@
|
|||
// PR c++/89212
|
||||
// { dg-do compile { target c++11 } }
|
||||
|
||||
template <int, typename T> using enable_if_t = int;
|
||||
|
||||
template<typename U, typename W, typename Y, class X, W(X::*foo)() = nullptr>
|
||||
struct p
|
||||
{
|
||||
template<U(Y::*fun)() = foo, typename T = enable_if_t<nullptr == fun, int>>
|
||||
p(T) { }
|
||||
p() = default;
|
||||
};
|
||||
|
||||
struct A
|
||||
{
|
||||
p<void, void, A, A> i = 1;
|
||||
void bar();
|
||||
p<void, void, A, A, &A::bar> j;
|
||||
};
|
Loading…
Add table
Reference in a new issue