[Issue 3416] Non-compilable template instantiation in is(typeof()) fails compilation

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Oct 19 02:00:54 PDT 2009


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



--- Comment #3 from Max Samukha <samukha at voliacable.com> 2009-10-19 02:00:52 PDT ---
That is just a minimal test case. We should be able to check if a template can
be instantiated with given template arguments. Here is a better test case:

template bar(T)
{
   void baz()
   {
      T a;
      a = null; // this may or may not be valid code, depending on T
   }
}

enum foo = is(typeof(bar!int)); // this should evaluate to false
----
test.d(22): Error: cannot implicitly convert expression (null) of type void* to
int

May be a regression.

Note that the following compiles as expected:

template bar(T)
{
    T a = null; // this may or may not be valid code, depending on T
}

static assert(!is(typeof(bar!int)));
static assert(is(typeof(bar!(void*))));

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