[Issue 3553] ICE when a function argument defaults to __LINE__

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Dec 1 11:17:09 PST 2009


http://d.puremagic.com/issues/show_bug.cgi?id=3553



--- Comment #4 from Don <clugdbug at yahoo.com.au> 2009-12-01 11:17:08 PST ---
(In reply to comment #3)
> Hrm.. what's that entire block of code in the 'if' doing?  TOKfile and TOKline
> are handled down through the layers of expression parsing (primarily in
> parsePrimaryExp) just fine, from a quick study of the code.

That block is dealing with __LINE__ as a default parameter. In that case only,
__LINE is the line that the function is instantiated in, rather than the line
it appeared in. So the other uses of TOKfile and TOKline are completely
different.

> Might it be better to change the
> two parts of parsePrimaryExp to create FileInitExp and LineInitExp's rather
> than StringExp and IntegerExp's respectively?

FileInitExp, LineInitExp are only handled when they're a default function
parameter. Lots of stuff would need to change if they were used throughout.

Basically, the whole thing seems to be a quick hack to get int line = __LINE__
working as a default parameter, which is by far the most important use case.
Dealing with the more complicated, obscure cases would be *much* more work.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list