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


--- Comment #0 from Denis Shelomovskij <verylonglogin.reg gmail.com> 2014-03-16
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


--- Comment #1 from Vladimir Panteleev <thecybershadow gmail.com> 2014-03-17
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



--- Comment #2 from Denis Shelomovskij <verylonglogin.reg gmail.com> 2014-03-17
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


--- Comment #3 from Kenji Hara <k.hara.pg gmail.com> 2014-03-17 08:02:43 PDT ---
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



--- Comment #4 from github-bugzilla puremagic.com 2014-03-23 03:07:19 PDT ---
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
Merge pull request #3385 from 9rnsr/fix12382

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