Summary: Template struct/class member functions should compile
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD

--- Comment #0 from 2012-09-11 06:15:40 PDT ---
>From the conversation here:

Not entirely sure if this is a bug, or an enhancement request (The answer I got
was "In this case I think D is working as designed")

struct S
  const int i;

struct C(T)
    private T val;
    @property T front()
        {return val;}
    @property void front(T value)
        {val = value;} //HERE

void main()
  C!S test;

This creates a compilation error at "here". Problem: The non-compiling function
was never called.

I think that member functions of template structs/classes should be compiled
conditionally only when they are called.

Doing otherwise really burdens the developer with making implementation
conditions for *all* his functions.

Suggest that member functions only be compiled and validated when called.

This *should* be possible, because doing this bypasses the problem:
struct C(T)
    private T val;
    @property T front()() //Template specialization
        {return val;}
    @property void front()(T value) //Template specialization
        {val = value;}

//Technically, the first specialization is not needed, but there is currently a
limitation regarding template/non-template overloads.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to