[Issue 10272] opAssign() not invoked during variable declaration and initialization

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jun 5 00:08:37 PDT 2013


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


Jonathan M Davis <jmdavisProg at gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |jmdavisProg at gmx.com
         Resolution|                            |INVALID


--- Comment #2 from Jonathan M Davis <jmdavisProg at gmx.com> 2013-06-05 00:08:35 PDT ---
This is completely expected. Variable declarations do not use the assignment
operator, and

int a = 1;

does not use the assignment operator at all. It's only assignments which use
the assignment operator. e.g.

a = 5;

When the variable is declared, it is initialized, not assigned to. While they
may seem similar and have similar syntax, they are fundamentally different. And
as w0rp points out, this behavior is exactly the same as C++'s behavior.

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