Bug 15286 – is(typeof(symbol))

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dlang.org
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-11-04T17:47:27Z
Last change time
2022-08-10T09:46:54Z
Keywords
trivial
Assigned to
No Owner
Creator
Luís Marques

Comments

Comment #0 by luis — 2015-11-04T17:47:27Z
The use of an is expression with the form `is(typeof(foo))`, such as in `static if(is(typeof(maybe_this_exists))`, is not documented in <http://dlang.org/expression.html#IsExpression> and is not an obvious composition of documented D features. Therefore, it would be nice if this was documented.
Comment #1 by dfj1esp02 — 2015-11-05T12:45:13Z
Well, it reads: --- Type is the type being tested. It must be syntactically correct, but it need not be semantically correct. If it is not semantically correct, the condition is not satisfied. --- Is it not enough?
Comment #2 by dfj1esp02 — 2015-11-05T12:47:49Z
That said I would prefer it to be extended to just `is(foo)` to check correctness of a declaration without needing typeof.
Comment #3 by luis — 2015-11-06T16:36:34Z
No, I don't think it is at all obvious from the description of `is` and from the description of `typeof` that we can use `is(typeof(foo))` to check whether foo exists and therefore can be used.
Comment #4 by razvan.nitu1305 — 2022-07-29T09:04:22Z
Comment #5 by dlang-bot — 2022-08-10T09:46:54Z
dlang/dlang.org pull request #3357 "Fix Issue 15286 - is(typeof(symbol))" was merged into master: - 8d86a16d4ef382f82c67f78b17f1cadd8dbd3121 by RazvanN7: Fix Issue 15286 - is(typeof(symbol)) https://github.com/dlang/dlang.org/pull/3357