[Issue 14387] New: Disallow string literals as assert conditions

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Apr 1 05:34:44 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14387

          Issue ID: 14387
           Summary: Disallow string literals as assert conditions
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: schuetzm at gmx.net

void foo(int x) {
        assert("foo");
        static assert("bar");
        if(!isXValid(x))
            assert("x has the invalid value of " ~ x.to!string);
    }

These should be disallowed, because it's too easy to forget the `0` as first
argument. Other expression that are concatenations of string literals should be
kept, of course.

--


More information about the Digitalmars-d-bugs mailing list