How to Fix Weird Build Failure with "-release" but OK with "-debug"?

apz28 home at home.com
Thu Jul 22 23:43:32 UTC 2021


On Thursday, 22 July 2021 at 18:56:43 UTC, Steven Schveighoffer 
wrote:
> On 7/22/21 2:38 PM, apz28 wrote:
>> On Wednesday, 21 July 2021 at 20:39:54 UTC, Dukc wrote:
>>> On Wednesday, 21 July 2021 at 14:15:51 UTC, Steven 
>>> Schveighoffer wrote:
>>>> 2. It's hard for me to see where the null dereference would 
>>>> be in that function (the `bool` implementation is pretty 
>>>> simple).
>>>>
>>>
>>> DMD complains about dereferences in three different lines. I 
>>> suspect it's `this` reference that is `null`.
>> 
>> Look like DMD has some bug. If I changed this line 
>> https://github.com/apz28/dlang/blob/02989b94bfe306d723f2780e010c61f71f873cbe/source/pham/db/db_fbdatabase.d#L148
>> 
>> 
>> from: auto reader = FbXdrReader(null, response.data);
>> to: auto reader = FbXdrReader(fbConnection, response.data);
>> 
>> then the error go away. FbXdrReader constructor allows to 
>> accept null for that parameter. Is it "safe" means not allow 
>> to pass null?
>
> I don't know what an FbConnection is, but it looks like you 
> call something on it. Your code is immense, and github search 
> really *really* sucks. So I can't get better information. But 
> if it's a class, and that is a normal member, it is indeed 
> dereferencing a null pointer.
>
> -Steve

FbConnection is a class, FbXdrReader is a struct and for this 
call, response.data is not null & its' length will be greater 
than zero and FbConnection is not being used. So why DMD try to 
evaluate at compiled time hence error
1. Should not evaluate at compile time for this function 
call/construct
2. The error message is missing proper line # or nothing related 
to the module displayed in error message

https://github.com/apz28/dlang/blob/main/source/pham/db/db_fbbuffer.d#L527



More information about the Digitalmars-d-learn mailing list