[Issue 8339] is(typeof(...)) is reporting true when it's false due to nested function error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jul 12 06:11:47 PDT 2012


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


Don <clugdbug at yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug at yahoo.com.au


--- Comment #1 from Don <clugdbug at yahoo.com.au> 2012-07-12 06:11:44 PDT ---
>So, the compiler thinks that is(typeof({R range;})) is true for the type of
>filter's result and then it gives an error saying that it's invalid to use it,
>meaning that it's _not_ valid and therefore is(typeof({R range;})) should be
>false.

That doesn't follow.
is(typeof(X)) only checks for a valid type. It does *not* check that the code
compiles. Checking that typeof(X) compiles is weaker than checking that X
compiles. There are several cases where you can obtain a type from something
you cannot possibly use. For example you can use typeof(this) in a static
member function.

OTOH
__traits(compiles, {R range; }) almost certainly behaves the same way, but it
isn't supposed to.

The issue is that the 'nested function' error is happening in the glue layer.
It should be happening in the front end.

-- 
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