From: Paolo Carlini Date: Thu, 7 Nov 2013 14:26:17 +0000 (+0000) Subject: re PR c++/58176 (ICE in output_constant, at varasm.c:4658) X-Git-Tag: upstream/12.2.0~66772 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fe79fc067e750e2e8a7e22861a088b8fde07ebbc;p=platform%2Fupstream%2Fgcc.git re PR c++/58176 (ICE in output_constant, at varasm.c:4658) 2013-11-07 Paolo Carlini PR c++/58176 * varasm.c (output_constant): Handle NULLPTR_TYPE. /testsuite 2013-11-07 Paolo Carlini PR c++/58176 * g++.dg/cpp0x/nullptr30.C: New. From-SVN: r204514 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 01d10e9..5679435 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2013-11-07 Paolo Carlini + + PR c++/58176 + * varasm.c (output_constant): Handle NULLPTR_TYPE. + 2013-11-07 H.J. Lu * config/i386/i386.c (ix86_expand_set_or_movmem): Don't set diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f6e735f..b45c8f4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-11-07 Paolo Carlini + + PR c++/58176 + * g++.dg/cpp0x/nullptr30.C: New. + 2013-11-07 Yury Gribov Jakub Jelinek diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr30.C b/gcc/testsuite/g++.dg/cpp0x/nullptr30.C new file mode 100644 index 0000000..3673999 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/nullptr30.C @@ -0,0 +1,40 @@ +// PR c++/58176 +// { dg-do compile { target c++11 } } + +// Nil +struct nil_ { constexpr nil_ () {} }; +constexpr nil_ nil; + +// Cons +template +struct cons_ { + using head_ = H; + using tail_ = T; + + H head; + T tail; + + constexpr cons_() {} + constexpr cons_(H const &h, T const &t) : head(h), tail(t) {} +}; +template +constexpr cons_ cons (H const &h, T const &t = nil) { return +cons_(h,t); } + +// List +template struct list_s; +template +struct list_s { + using type = cons_::type>; +}; +template <> +struct list_s<> { + using type = nil_; +}; +template +using list_ = typename list_s::type; +constexpr nil_ list () { return nil; } +template +constexpr list_ list (H h, T... t) { return cons(h, list(t...)); } + +constexpr auto l1 = list("monkey", 123.4, cons(1, 2), nullptr); diff --git a/gcc/varasm.c b/gcc/varasm.c index beafb55..2226912 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -4685,6 +4685,7 @@ output_constant (tree exp, unsigned HOST_WIDE_INT size, unsigned int align) case OFFSET_TYPE: case FIXED_POINT_TYPE: case POINTER_BOUNDS_TYPE: + case NULLPTR_TYPE: if (! assemble_integer (expand_expr (exp, NULL_RTX, VOIDmode, EXPAND_INITIALIZER), MIN (size, thissize), align, 0))