www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7788] New: __gshared and UFCS - "Error: nested structs with constructors are not yet supported in CTFE (Bug 6419)"

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

           Summary: __gshared and UFCS - "Error: nested structs with
                    constructors are not yet supported in CTFE (Bug 6419)"
           Product: D
           Version: D2
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: simendsjo gmail.com



The following worked on an earlier head of 2.059, but as of yesterday, it
fails:

import std.algorithm, std.array, std.utf, std.conv;
void main() {
    auto ok = [1].map!("a*1")().array();
    __gshared auto ok2 = [1].map!("a*1")();
    __gshared auto bug = [1].map!("a*1")().array();
}

Only tested on linux with and without -m32

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 28 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7788




Oh, and the following works too:

    __gshared int[] ok3;
    ok3 = [1].map!("a*1")().array();

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 28 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7788


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc



This program:


import std.algorithm, std.array;
void main() {
    __gshared r = [1].map!q{a * 1}();
}


gives to me (2.059head, 32 bit Windows):

...\dmd2\src\phobos\std\algorithm.d(461): Error: nested structs with
constructors are not yet supported in CTFE (Bug 6419)
test.d(3):        called from here: map([1])

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 28 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7788


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
                 CC|                            |clugdbug yahoo.com.au
           Severity|regression                  |normal



Not a regression - didn't work on any prior release.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 29 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7788




Pretty sure it worked at the start of this week.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 29 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7788




I'm not sure what is wrong. __gshared variable declaration is treated like
static variable one (even if it is in local), and its initializer is *always*
const-folded by interpretation(== CTFE).

And the behavior is in there from earlier than 2.058. So I'm sure that the
expressions have been failed to compile with bug 6419 and this issue never
relates to UFCS.

To simendsjo:
Please tell us the exact commit hash of dmd repository that succeeds to compile
the code. If you cannot do it, I'll close this bug as "resolved invalid" bug.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 29 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7788





 Pretty sure it worked at the start of this week.
It only gets a 'regression' tag if it worked as part of a release. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 30 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7788


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 04 2012