www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11361] New: [2.064 beta] Variant fails to compile with functions/delegates that contain const parameters.

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11361

           Summary: [2.064 beta] Variant fails to compile with
                    functions/delegates that contain const parameters.
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: opantm2+dbugs gmail.com


--- Comment #0 from Kapps <opantm2+dbugs gmail.com> 2013-10-25 18:29:27 PDT ---
Example:
import std.variant;

const(char[]) t1(const(char[]) c) {
        return c;
}

void main() {
        auto fn = &t1;
        Variant v = fn;
}

Output:
dmd test.d
/Users/kapps/dev/dmd/phobos/std/variant.d(515): Error: can only initialize
const member _expand_field_0 inside constructor
/Users/kapps/dev/dmd/phobos/std/variant.d(585): Error: template instance
std.variant.VariantN!(32LU).VariantN.handler!(const(char[])
function(const(char[]))) error instantiating
/Users/kapps/dev/dmd/phobos/std/variant.d(535):        instantiated from here:
opAssign!(const(char[]) function(const(char[]) c))
test.d(9):        instantiated from here: __ctor!(const(char[])
function(const(char[]) c))
/Users/kapps/dev/dmd/phobos/std/variant.d(535): Error: template instance
std.variant.VariantN!(32LU).VariantN.opAssign!(const(char[])
function(const(char[]) c)) error instantiating
test.d(9):        instantiated from here: __ctor!(const(char[])
function(const(char[]) c))
test.d(9): Error: template instance
std.variant.VariantN!(32LU).VariantN.__ctor!(const(char[])
function(const(char[]) c)) error instantiating

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 25 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11361


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, rejects-valid
            Version|unspecified                 |D2


--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2013-10-26 06:23:49 PDT ---
https://github.com/D-Programming-Language/phobos/pull/1667

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 26 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11361



--- Comment #2 from github-bugzilla puremagic.com 2013-10-26 13:32:16 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/4d30a5f278ec16b83148db85bc5bcaa2027f5644
Fix issue 11361 - Variant fails to compile with delegates containing const
arguments.

https://github.com/D-Programming-Language/phobos/commit/3fd3cee0d02cc0e114bfca3665512faabf93c4cb
Merge pull request #1667 from Kapps/fix11361

Fix issue 11361 - Variant fails to compile with functions containing const
arguments.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 26 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11361



--- Comment #3 from github-bugzilla puremagic.com 2013-10-26 13:34:59 PDT ---
Commit pushed to 2.064 at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/f2f11867dae630ba950090648ed7c9a3bda9471b
Merge pull request #1667 from Kapps/fix11361

Fix issue 11361 - Variant fails to compile with functions containing const
arguments.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 26 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11361


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 26 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11361



--- Comment #4 from Walter Bright <bugzilla digitalmars.com> 2013-10-27
13:22:05 PDT ---
This fixes master, but fails to fix 2.064. Apparently there are other changes
to phobos necessary. In fact, putting in the variant.d from master also fails
its unittests in 2.064.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 27 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11361



--- Comment #5 from Walter Bright <bugzilla digitalmars.com> 2013-10-27
13:26:34 PDT ---
This is not a regression for 2.064. In fact, pulling this fix breaks 2.064.
I'll change the title.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 27 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11361



--- Comment #6 from Kapps <opantm2+dbugs gmail.com> 2013-10-27 14:52:46 PDT ---
(In reply to comment #5)
 This is not a regression for 2.064. In fact, pulling this fix breaks 2.064.
 I'll change the title.
Sorry, I wasn't aware that there was a difference between 2.064 beta and master, but I see now that there's a separate release branch for 2.064. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 27 2013