Re: [C++ PATCH] Fix offsetof constexpr handling (PR c++/85662, take 4)

2018-05-10 Thread Jason Merrill
OK, thanks. On Wed, May 9, 2018 at 4:49 PM, Jakub Jelinek wrote: > On Wed, May 09, 2018 at 11:01:18AM -0400, Jason Merrill wrote: >> On Wed, May 9, 2018 at 10:47 AM, Jakub Jelinek wrote: >> > On Wed, May 09, 2018 at 10:40:26AM -0400, Jason Merrill wrote: >> >> On Wed, May 9, 2018 at 4:55 AM, Jak

[C++ PATCH] Fix offsetof constexpr handling (PR c++/85662, take 4)

2018-05-09 Thread Jakub Jelinek
On Wed, May 09, 2018 at 11:01:18AM -0400, Jason Merrill wrote: > On Wed, May 9, 2018 at 10:47 AM, Jakub Jelinek wrote: > > On Wed, May 09, 2018 at 10:40:26AM -0400, Jason Merrill wrote: > >> On Wed, May 9, 2018 at 4:55 AM, Jakub Jelinek wrote: > >> > On Tue, May 08, 2018 at 11:28:18PM -0400, Jaso

Re: [C++ PATCH] Fix offsetof constexpr handling (PR c++/85662)

2018-05-09 Thread Jason Merrill
On Wed, May 9, 2018 at 10:47 AM, Jakub Jelinek wrote: > On Wed, May 09, 2018 at 10:40:26AM -0400, Jason Merrill wrote: >> On Wed, May 9, 2018 at 4:55 AM, Jakub Jelinek wrote: >> > On Tue, May 08, 2018 at 11:28:18PM -0400, Jason Merrill wrote: >> >> Maybe add a type parameter that defaults to size

Re: [C++ PATCH] Fix offsetof constexpr handling (PR c++/85662)

2018-05-09 Thread Jakub Jelinek
On Wed, May 09, 2018 at 10:40:26AM -0400, Jason Merrill wrote: > On Wed, May 9, 2018 at 4:55 AM, Jakub Jelinek wrote: > > On Tue, May 08, 2018 at 11:28:18PM -0400, Jason Merrill wrote: > >> Maybe add a type parameter that defaults to size_type_node... > >> > >> > + ret = fold_convert_loc (lo

Re: [C++ PATCH] Fix offsetof constexpr handling (PR c++/85662)

2018-05-09 Thread Jason Merrill
On Wed, May 9, 2018 at 4:55 AM, Jakub Jelinek wrote: > On Tue, May 08, 2018 at 11:28:18PM -0400, Jason Merrill wrote: >> Maybe add a type parameter that defaults to size_type_node... >> >> > + ret = fold_convert_loc (loc, TREE_TYPE (expr), >> > + fold_offsetof_1

Re: [C++ PATCH] Fix offsetof constexpr handling (PR c++/85662)

2018-05-09 Thread Jakub Jelinek
On Tue, May 08, 2018 at 11:28:18PM -0400, Jason Merrill wrote: > Maybe add a type parameter that defaults to size_type_node... > > > > > --- gcc/c/c-fold.c.jj 2018-01-17 22:00:12.310228253 +0100 > > +++ gcc/c/c-fold.c 2018-05-08 21:52:43.303940175 +0200 > > @@ -473,7 +473,8 @@ c_fully_fold_

Re: [C++ PATCH] Fix offsetof constexpr handling (PR c++/85662)

2018-05-08 Thread Jason Merrill
On Tue, May 8, 2018 at 4:04 PM, Jakub Jelinek wrote: > On Tue, May 08, 2018 at 01:03:00PM -0400, Jason Merrill wrote: >> On Sun, May 6, 2018 at 1:56 PM, Jakub Jelinek wrote: >> > --- gcc/c-family/c-common.c.jj 2018-03-27 21:58:55.598502113 +0200 >> > +++ gcc/c-family/c-common.c 2018-05-05 10

Re: [C++ PATCH] Fix offsetof constexpr handling (PR c++/85662)

2018-05-08 Thread Jakub Jelinek
On Tue, May 08, 2018 at 01:03:00PM -0400, Jason Merrill wrote: > On Sun, May 6, 2018 at 1:56 PM, Jakub Jelinek wrote: > > --- gcc/c-family/c-common.c.jj 2018-03-27 21:58:55.598502113 +0200 > > +++ gcc/c-family/c-common.c 2018-05-05 10:55:47.951600802 +0200 > > @@ -6171,7 +6171,7 @@ c_common_t

Re: [C++ PATCH] Fix offsetof constexpr handling (PR c++/85662)

2018-05-08 Thread Jason Merrill
On Sun, May 6, 2018 at 1:56 PM, Jakub Jelinek wrote: > --- gcc/c-family/c-common.c.jj 2018-03-27 21:58:55.598502113 +0200 > +++ gcc/c-family/c-common.c 2018-05-05 10:55:47.951600802 +0200 > @@ -6171,7 +6171,7 @@ c_common_to_target_charset (HOST_WIDE_IN > traditional rendering of offsetof

[C++ PATCH] Fix offsetof constexpr handling (PR c++/85662)

2018-05-06 Thread Jakub Jelinek
Hi! fold_offsetof_1 builds the base as usually INTEGER_CST with pointer type and calls fold_build_pointer_plus with the offset gathered from the COMPONENT_REF field offset or ARRAY_REF index or combination of them. But most of the fold_* routines aren't recursive, they fold just one level, so if t