digitalmars.D.bugs - [Issue 2848] New: static if (is(type)) + alias fails to compile
- d-bugmail puremagic.com (32/32) Apr 17 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2848
- d-bugmail puremagic.com (4/4) Apr 17 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2848
- d-bugmail puremagic.com (15/15) Apr 17 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2848
- d-bugmail puremagic.com (13/13) Apr 17 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2848
- d-bugmail puremagic.com (10/10) Jun 21 2010 http://d.puremagic.com/issues/show_bug.cgi?id=2848
- d-bugmail puremagic.com (14/20) Jun 21 2010 http://d.puremagic.com/issues/show_bug.cgi?id=2848
- d-bugmail puremagic.com (7/16) Jun 22 2010 http://d.puremagic.com/issues/show_bug.cgi?id=2848
http://d.puremagic.com/issues/show_bug.cgi?id=2848
Summary: static if (is(type)) + alias fails to compile
Product: D
Version: 1.043
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla digitalmars.com
ReportedBy: llucax gmail.com
This simple test fails to compile:
static if (!is(typeof(no_type)))
alias char[] no_type;
no_type x;
In all D compilers available, tested in GDC, DMD 1.043, DMD 2.027 and LDC r1197
(so it seems like a front-end issue).
The error is:
t.d:3: Error: identifier 'no_type' is not defined
t.d:3: Error: no_type is used as a type
t.d:3: variable t.x voids have no value
This test doesn't compile either:
static if (!is(typeof(no_type))) {
alias char[] no_type;
no_type y;
}
Error:
t.d(3): Error: identifier 'no_type' is not defined
t.d(3): Error: no_type is used as a type
t.d(3): variable t.x voids have no value
--
Apr 17 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2848 BTW, using static if (is(typeof(no_type))) doesn't work either. --
Apr 17 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2848
It seems to happen for array, int and float aliasee, but not for Object or
struct types...
This workaround works:
alias char[] String;
static if (!is(no_type)) {
alias String no_type;
no_type y;
}
no_type x;
It seems not to fail when aliassed to user-defined types (classes, structs,
enums, aliases, typedefs), but for primitive types and arrays it fails.
typedef have the same problem.
--
Apr 17 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2848
Workaround:
----
alias char[] String;
static if (!is(no_type))
alias String no_type;
no_type x;
----
It seems to fail when the aliased type is a primitive type or array (static,
dynamic or associative).
It doesn't fail if it's a class, struct, enum, typedef or aliased type.
--
Apr 17 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2848 PDT --- Works in DMD 1.062, I don't know when it got fixed. I guess it will work in DMD 2.0xx, but I don't have one installed to test. If somebody wants to try it, this bug can be closed (maybe Don who seems to bisect a lot and has an environment to do that easily wants to bisect DMD to see when it got fixed and add the proper changelog entry ;). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 21 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2848
Don <clugdbug yahoo.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |clugdbug yahoo.com.au
Resolution| |FIXED
Works in DMD 1.062, I don't know when it got fixed. I guess it will work in DMD
2.0xx, but I don't have one installed to test.
If somebody wants to try it, this bug can be closed (maybe Don who seems to
bisect a lot and has an environment to do that easily wants to bisect DMD to
see when it got fixed and add the proper changelog entry ;).
No probs.
Fixed DMD 1.050.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 21 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2848 PDT ---Thanks =) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------Works in DMD 1.062, I don't know when it got fixed. I guess it will work in DMD 2.0xx, but I don't have one installed to test. If somebody wants to try it, this bug can be closed (maybe Don who seems to bisect a lot and has an environment to do that easily wants to bisect DMD to see when it got fixed and add the proper changelog entry ;).No probs. Fixed DMD 1.050.
Jun 22 2010









d-bugmail puremagic.com 