Re: r311065 - Further refactoring of the constant emitter. NFC.

2019-03-18 Thread John McCall via cfe-commits
On 18 Mar 2019, at 18:05, John McCall wrote: On 18 Mar 2019, at 15:38, Don Hinton wrote: Hi John: I found this investigating the cast assert noted here: http://lists.llvm.org/pipermail/cfe-dev/2019-March/061685.html I subsequently did quick grep and found a number of cases in clang+llvm (d

Re: r311065 - Further refactoring of the constant emitter. NFC.

2019-03-18 Thread John McCall via cfe-commits
On 18 Mar 2019, at 15:38, Don Hinton wrote: Hi John: I found this investigating the cast assert noted here: http://lists.llvm.org/pipermail/cfe-dev/2019-March/061685.html I subsequently did quick grep and found a number of cases in clang+llvm (didn't find any in other projects) . I'm happy t

Re: r311065 - Further refactoring of the constant emitter. NFC.

2019-03-18 Thread Don Hinton via cfe-commits
Hi John: I found this investigating the cast assert noted here: http://lists.llvm.org/pipermail/cfe-dev/2019-March/061685.html I subsequently did quick grep and found a number of cases in clang+llvm (didn't find any in other projects) . I'm happy to fix these in mass, i.e., s/cast/dyn_cast/, but

Re: r311065 - Further refactoring of the constant emitter. NFC.

2019-03-18 Thread John McCall via cfe-commits
On 18 Mar 2019, at 14:39, Don Hinton wrote: It looks like this change introduced a small bug; Specifically, the following cast test: - if (auto PT = dyn_cast(DestTy)) { ... + // If we're producing a pointer, this is easy. + if (auto destPtrTy = cast(destTy)) { Since the cast can fail, s

Re: r311065 - Further refactoring of the constant emitter. NFC.

2019-03-18 Thread Don Hinton via cfe-commits
It looks like this change introduced a small bug; Specifically, the following cast test: - if (auto PT = dyn_cast(DestTy)) { ... + // If we're producing a pointer, this is easy. + if (auto destPtrTy = cast(destTy)) { Since the cast can fail, shouldn't you prefer dyn_cast<>(), which can re