[Issue 7570] New: No true error message in one CTFE

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Feb 24 05:05:22 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7570

           Summary: No true error message in one CTFE
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2012-02-24 05:05:19 PST ---
This may be wrong D2 code, if DMD is not able to run it at compile-time:


bool not_end(const char *s, const int n) {
    return s && s[n];
}
bool str_prefix(const char *s, const char *t, const int ns, const int nt) {
    return (s == t) || !*(t + nt) || (*(s + ns) == *(t + nt) && (str_prefix(s,
t, ns+1, nt+1)));
}
bool contains(const char *s, const char *needle, const int n=0) {
    return not_end(s, n) && (str_prefix(s, needle, n, 0) || contains(s, needle,
n+1));
}
enum int x = contains("froogler", "oogle");
void main() {}



DMD 2.059head gives no true error message, just some "called from here":

bug.d(8):        called from here: str_prefix(s,needle,n,0)
bug.d(10):        called from here: contains("froogler","oogle",0)
bug.d(8):        called from here: str_prefix(s,needle,n,0)
bug.d(10):        called from here: contains("froogler","oogle",0)
bug.d(8):        called from here: str_prefix(s,needle,n,0)
bug.d(10):        called from here: contains("froogler","oogle",0)

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


More information about the Digitalmars-d-bugs mailing list