Advertisement
Guest User

Untitled

a guest
Oct 13th, 2013
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 0.41 KB | None | 0 0
  1. enum xxx = false;
  2.  
  3. struct A {
  4.  
  5.     static if (xxx) {
  6.         ref A opAssign(ref const A a) {
  7.             return this;
  8.         }
  9.     }
  10.  
  11.     ref A opAssign(int v) {
  12.         return this;
  13.     }
  14.  
  15. }
  16.  
  17. struct B {
  18.     A a;
  19.     alias a this;
  20. }
  21.  
  22. void main() {
  23.     A a;
  24.     B b;
  25.     b = a; // With xxx == true this gives an error, but it compiles fine with xxx == false.
  26.     a = b; // With xxx == false this gives an error, but it compiles fine with xxx == true.
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement