www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22629] New: inlining affects assert messages with

https://issues.dlang.org/show_bug.cgi?id=22629

          Issue ID: 22629
           Summary: inlining affects assert messages with -checkaction=C
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: duser airmail.cc

---
void main()
{
        mydata data;
        assert(check(&data));
}

struct mydata
{
        int a, b, c;
}

bool check(mydata* p)
{
        return p.a == 1 && p.b == 2 && p.c == 3;
}
---

% dmd -checkaction=C -run asserttest.d
dmd_runzAP3V1: asserttest.d:4: Assertion `check(& data)' failed.

% dmd -inline -checkaction=C -run asserttest.d
dmd_runJ6qb9y: asserttest.d:12: Assertion `(mydata* p = & data;) , (*p).a == 1
&& ((*p).b == 2) && ((*p).c == 3)' failed.

two problems with the output:
- the line number of the assert statement is replaced with the line number of
the inlined code
- the original expression in the message is replaced with the inlined
function's contents

--
Dec 25 2021