This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ PATCH for c++/57891, narrowing conversions in non-type template arguments
- From: Marek Polacek <polacek at redhat dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 7 Sep 2018 11:20:07 -0400
- Subject: Re: C++ PATCH for c++/57891, narrowing conversions in non-type template arguments
- References: <CADzB+2kg8nk2EmgcKqZ=S9HVUV_0LhOHKeOdoERcvnt2ZKpLLA@mail.gmail.com> <CADzB+2=Z7CXZMECZcrx4D+p+OpsLyHisXuMKP-SJCHePLc6zfw@mail.gmail.com> <20180723204912.GH29486@redhat.com> <CADzB+2=-uJtJQCijV534Xs9nqH_Xqm=WUgzuPP-RQdDvFxvNJQ@mail.gmail.com> <20180809205940.GJ4317@redhat.com> <CADzB+2=b=pPOCbTK6_ze3m-imeEkqTaS6e54OjM5Fz=aByh7yA@mail.gmail.com> <20180811141350.GL4317@redhat.com> <CADzB+2n-GqOSOT=j5JHuTPxHb-WYp4z5a5K8Tz5QQObTQq9RqQ@mail.gmail.com> <20180813222438.GR4317@redhat.com> <CADzB+2k-v=SWNg+H6zBAG3r4inWYevxb2eDiGesia4FX3cBwEw@mail.gmail.com>
On Fri, Sep 07, 2018 at 01:40:53PM +0100, Jason Merrill wrote:
> > 2018-08-13 Marek Polacek <polacek@redhat.com>
> >
> > PR c++/57891
> > * call.c (struct conversion): Add check_narrowing_const_only.
> > (build_converted_constant_expr): Set check_narrowing and
> > check_narrowing_const_only. Give error if expr is error node.
> > (convert_like_real): Pass it to check_narrowing.
> > * cp-tree.h (check_narrowing): Add a default parameter.
> > * decl.c (compute_array_index_type): Use input_location instead of
> > location_of.
> > * pt.c (convert_nontype_argument): Return NULL_TREE if tf_error.
> > * typeck2.c (check_narrowing): Don't warn for instantiation-dependent
> > expressions. Call maybe_constant_value instead of
> > fold_non_dependent_expr. Don't mention { } in diagnostic. Only check
> > narrowing for constants if CONST_ONLY.
>
> This seems to have broken cpp1z/direct-enum-init1.C with -std=c++17
> and above; please use make check-c++-all (or set
> GXX_TESTSUITE_STDS=98,11,14,17,2a) to test C++ patches in all
> conformance modes.
Sorry about that, I've updated my testing and will fix it shortly.
Marek