On Fri, Jun 09, 2017 at 03:46:41PM -0700, Jason Merrill wrote:
> Something that was missed previously in the delayed folding work:
> there's no good reason to be pulling values out of constants in
> convert_like_real.

Well, it breaks nontype10.C on 32-bit targets.
Or, let's use a modified version of nontype10.C:
#define NULL __null

template <int T> struct A {};
template <long T> struct B {};
template <long long T> struct C {};

A<NULL> a; // { dg-warning "NULL" }
B<NULL> b; // { dg-warning "NULL" }
C<NULL> c; // { dg-warning "NULL" }

previously we'd emit for both -m32 and -m64 just 3 warnings, but the trunk
emits many further ones:
nontype10.C: In instantiation of ‘struct B<0>’:
nontype10.C:8:9:   required from here
nontype10.C:4:28: warning: converting to non-pointer type ‘long int’ from NULL 
[-Wconversion-null]
 template <long T> struct B {};
                            ^
nontype10.C:4:28: warning: converting to non-pointer type ‘long int’ from NULL 
[-Wconversion-null]
nontype10.C:4:28: warning: converting to non-pointer type ‘long int’ from NULL 
[-Wconversion-null]
on top of the 3 desired ones with -m64, or:
nontype10.C: In instantiation of ‘struct A<0>’:
nontype10.C:7:9:   required from here
nontype10.C:3:27: warning: converting to non-pointer type ‘int’ from NULL 
[-Wconversion-null]
 template <int T> struct A {};
                           ^
nontype10.C:3:27: warning: converting to non-pointer type ‘int’ from NULL 
[-Wconversion-null]
nontype10.C:3:27: warning: converting to non-pointer type ‘int’ from NULL 
[-Wconversion-null]
on top of the 3 desired ones with -m32.  The problem is that the conversion
of null_node to int (for -m32) or long int (for -m64) remains to be
null_node rather than some other INTEGER_CST, so we warn again and again.

        Jakub

Reply via email to