Thread overview
[Issue 7788] New: __gshared and UFCS - "Error: nested structs with constructors are not yet supported in CTFE (Bug 6419)"
Mar 28, 2012
simendsjo
Mar 28, 2012
simendsjo
Mar 29, 2012
Don
Mar 29, 2012
simendsjo
Mar 30, 2012
Kenji Hara
Mar 30, 2012
Don
Apr 04, 2012
Don
March 28, 2012
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


--- Comment #0 from simendsjo <simendsjo@gmail.com> 2012-03-28 00:41:09 PDT ---
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: -------
March 28, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7788



--- Comment #1 from simendsjo <simendsjo@gmail.com> 2012-03-28 00:44:40 PDT ---
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: -------
March 28, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7788


bearophile_hugs@eml.cc changed:

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


--- Comment #2 from bearophile_hugs@eml.cc 2012-03-28 04:32:21 PDT ---
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: -------
March 29, 2012
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


--- Comment #3 from Don <clugdbug@yahoo.com.au> 2012-03-29 12:14:29 PDT ---
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: -------
March 29, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7788



--- Comment #4 from simendsjo <simendsjo@gmail.com> 2012-03-29 12:23:33 PDT ---
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: -------
March 30, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7788



--- Comment #5 from Kenji Hara <k.hara.pg@gmail.com> 2012-03-29 20:59:35 PDT ---
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: -------
March 30, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7788



--- Comment #6 from Don <clugdbug@yahoo.com.au> 2012-03-30 16:28:44 PDT ---
(In reply to comment #4)
> 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: -------
April 04, 2012
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: -------