[Issue 11554] `is(T == enum); ` produces an error if T is an enum defined with no members

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Nov 26 23:07:26 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=11554


Puneet Goel <puneet at coverify.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |puneet at coverify.org
         Resolution|FIXED                       |


--- Comment #3 from Puneet Goel <puneet at coverify.org> 2013-11-26 23:07:19 PST ---
Here is another test case. The bug still shows up if the member-less enum is in
another module. Works with version 2.064. Fails with github head.

$ dmd test.d
test.d(2): Error: enum test.zoo is forward referenced looking for base type


// File frop.d
module frop;
struct bro(N...) {}
size_t foo(size_t I=0, T)(T t) {
  static if(I == t.tupleof.length) return 0;
  else {
    if(baz!(0, -1, __traits(getAttributes, t.tupleof[I]))) foo!(I+1)(t);
    return foo!(I+1)(t);
  }
}
template baz(size_t C, int P, A...) {
  static if(A.length == 0) enum baz = P;
  else static if(is(A[0] unused: bro!M, M...)) {}
    else enum baz = baz!(C+1, P, A[1..$]);
}


// File test.d
import frop;
enum zoo;
class Bar { @zoo ubyte pop; }
void main() { foo(new Bar); }

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


More information about the Digitalmars-d-bugs mailing list