D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 15286 - is(typeof(symbol))
Summary: is(typeof(symbol))
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dlang.org (show other issues)
Version: D2
Hardware: All All
: P1 enhancement
Assignee: No Owner
URL:
Keywords: trivial
Depends on:
Blocks:
 
Reported: 2015-11-04 17:47 UTC by Luís Marques
Modified: 2022-08-10 09:46 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Luís Marques 2015-11-04 17:47:27 UTC
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 anonymous4 2015-11-05 12:45:13 UTC
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 anonymous4 2015-11-05 12:47:49 UTC
That said I would prefer it to be extended to just `is(foo)` to check correctness of a declaration without needing typeof.
Comment 3 Luís Marques 2015-11-06 16:36:34 UTC
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 RazvanN 2022-07-29 09:04:22 UTC
PR: https://github.com/dlang/dlang.org/pull/3357/
Comment 5 Dlang Bot 2022-08-10 09:46:54 UTC
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