www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12382] New: `opDollar` can't be used at CT

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

           Summary: `opDollar` can't be used at CT
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: verylonglogin.reg gmail.com



17:58:43 MSK ---
This code used to work:
---
struct S
{
    size_t opDollar() { return 0; }
    size_t opIndex(size_t) { return 0; }
}

enum e = S.init[$]; // line 7
---
main.d(7): Error: static variable __dollar cannot be read at compile time
main.d(7):        called from here: S().opIndex(__dollar)
---

This is a rather old regression.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 16 2014
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12382


Vladimir Panteleev <thecybershadow gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thecybershadow gmail.com



09:54:38 EET ---
When did it work? opDollar was implemented in 2.057 and the code doesn't
compile in any version since then.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 17 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12382




17:18:59 MSK ---
It worked e.g. when this commit was made:
https://bitbucket.org/denis-sh/unstandard/commits/125b712a9c53b14d2ea4aee387d48b279d6c8201

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 17 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12382


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, rejects-valid



https://github.com/D-Programming-Language/dmd/pull/3385

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 17 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12382




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/4c97247132864c2dea65f6743392261c90ec8ac0
fix Issue 12382 - `opDollar` can't be used at CT

Front-end should handle opDollar side-effect carefully, because CTFE engine
cannot interpret `(auto __dollar = obj.opDollar(), obj).opIndex(__dollar)`
without CTFE stack.

https://github.com/D-Programming-Language/dmd/commit/efe0e45fecfa2b324ae382e77e6456a419abc657


Issue 12382 - `opDollar` can't be used at CT

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 23 2014
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12382


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

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


-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 23 2014