[Issue 1820] default template parameters cannot be omitted

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jul 2 21:33:35 PDT 2011


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


yebblies <yebblies at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies at gmail.com


--- Comment #1 from yebblies <yebblies at gmail.com> 2011-07-03 14:28:33 EST ---
The issue here is in:

template func(T)
{
    static if (cond)
        void func(T x) {}
}

func is only a function template (onemember) when cond is true, and in the
general case cond may rely on T, which relies on ifti.

The following might illustrate it better:

template func(T)
{
    static if (is(T == int)) // how could we know this before performing ifti?
        void func(T* x) {}
}

The compiler cannot generally evaluate static if conditions without the
template args being known.  Although it could in very simple cases, I'm not
sure it's worth the effort.

One place I think this could be done is inside VersionConditions.

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