--- Comment #3 from Steven Schveighoffer <> 2011-09-20 
08:47:22 PDT ---
void c() const {}

This should work, as mutable and const implicitly cast to immutable.

Two other things (even though the above is the *right* solution to your

1. You can overload c, you don't need to use a template
2. You *can* get the exact type called with by using a this template parameter:

import std.stdio;

struct b
    void c(this T)() const

void main()
    immutable b b1;
    b b2;



But please note, the struct a has nothing to do with these issues, it's just
simply a way you have declared an immutable b (which you can easily do on the

Declaring an immutable struct is the same as applying immutable to all the
members.  Declaring a local immutable variable is the same thing.

Also note that in your attempt to use if constraints, you must use templates
(I'm sure you would have gotten error messages, so I think this is a simple
copy-paste omission)

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

Reply via email to