www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1017] New: CTFE doesn't support (string == string)

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

           Summary: CTFE doesn't support (string == string)
           Product: D
           Version: 1.007
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: reiner.pope gmail.com


The following code fails in DMD 1.007:

void main()
{
    static assert(equals("alphabet", "alphabet"));
}

bool equals(char[] a, char[] b)
{
    return (a == b);
}

equality.d(3): static assert  (equals("alphabet","alphabet")) is not
evaluatable
 at compile time


-- 
Mar 03 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1017






Put equals() before main() and it should work.


-- 
Mar 03 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1017







 Put equals() before main() and it should work.
It doesn't: --- urxae urxae:~/tmp$ cat test.d bool equals(char[] a, char[] b) { return (a == b); } void main() { static assert(equals("alphabet", "alphabet")); } urxae urxae:~/tmp$ dmd test.d test.d(8): static assert (equals("alphabet","alphabet")) is not evaluatable at compile time --- --
Mar 03 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1017


smjg iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg iname.com
           Keywords|                            |rejects-valid






 Put equals() before main() and it should work.
Under which platform did you observe a dependency on the order of declarations in this instance? Clearly not that on which the reporter reported the problem. --
Mar 04 2007
prev sibling next sibling parent reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1017


fvbommel wxs.nl changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         OS/Version|Windows                     |All







 Put equals() before main() and it should work.
Under which platform did you observe a dependency on the order of declarations in this instance? Clearly not that on which the reporter reported the problem.
Actually, it could be the same as the reporter. My test of Walter's theory was done on Linux, while the reporter is appears to be using Windows. I have no idea if it works on Windows if the order is switched, but I _can_ confirm this bug on Linux, so I'll just change the OS setting to 'all'... --
Mar 04 2007
parent Don Clugston <dac nospam.com.au> writes:
d-bugmail puremagic.com wrote:
 http://d.puremagic.com/issues/show_bug.cgi?id=1017
 
 
 fvbommel wxs.nl changed:
 
            What    |Removed                     |Added
 ----------------------------------------------------------------------------
          OS/Version|Windows                     |All
 
 
 
 



 Put equals() before main() and it should work.
Under which platform did you observe a dependency on the order of declarations in this instance? Clearly not that on which the reporter reported the problem.
Actually, it could be the same as the reporter. My test of Walter's theory was done on Linux, while the reporter is appears to be using Windows. I have no idea if it works on Windows if the order is switched, but I _can_ confirm this bug on Linux, so I'll just change the OS setting to 'all'...
That's correct. I haven't found any configuration where it compiles under Windows -- and I tried pretty hard to get around this one... for example, slicing the arrays does not help. Even this (arguably simpler) variation doesn't work: bool a() { return "x"!="y"; } void main() { static assert( a() ); }
Mar 05 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1017






Added to DStress as
http://dstress.kuehne.cn/compile/o/opEquals_07_A.d
http://dstress.kuehne.cn/compile/o/opEquals_07_B.d
http://dstress.kuehne.cn/compile/o/opEquals_07_C.d
http://dstress.kuehne.cn/compile/o/opEquals_07_D.d
http://dstress.kuehne.cn/compile/o/opEquals_07_E.d
http://dstress.kuehne.cn/compile/o/opEquals_07_F.d


-- 
Mar 08 2007
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1017


thomas-dloop kuehne.cn changed:

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





Fixed in DMD-1.009


-- 
Mar 11 2007