dmd icon indicating copy to clipboard operation
dmd copied to clipboard

Skip codegen not set on typeof function literal

Open rikkimax opened this issue 4 months ago • 2 comments

I encountered some code similar to:

alias T = typeof({
}());

The skip codegen property of this function literal will not have been set on its declaration prior to semantic 3 finishing.

https://github.com/sociomantic-tsunami/ocean/blob/b06be4d9c6099bb756a801e13e8b945ea05c2abe/src/ocean/meta/types/Function.d#L117

Code like this is used for introspection and never runs, it may not even run at CTFE.

In this particular case a null dereference took place, but it runs no risk to the resulting program if a DFA isn't run on it. So I'd like to have this information available so that it can skip it, preventing a perceived false positive.

rikkimax avatar Sep 15 '25 09:09 rikkimax

What is the difference compared to issue #21695?

tim-dlang avatar Sep 28 '25 11:09 tim-dlang

None, good catch.

rikkimax avatar Sep 28 '25 16:09 rikkimax