www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 965] New: incorrect result for "is(BadTemplate!())"

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

           Summary: incorrect result for "is(BadTemplate!())"
           Product: D
           Version: 1.005
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P3
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: thomas-dloop kuehne.cn












bug_e2ir_520_C.d(18): static assert  (0 == 1) is false

test case:
http://dstress.kuehne.cn/compile/b/bug_e2ir_520_B.d


-- 
Feb 15 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=965






This is happening because compiling this()'s body is not necessary to determine
the type. Not sure if this is a bug or not.


-- 
Aug 12 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=965


Max Samukha <samukha voliacable.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |samukha voliacable.com



PDT ---
*** Issue 3416 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 28 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=965


Denis <verylonglogin.reg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |verylonglogin.reg gmail.com
           Platform|x86                         |All
            Version|1.005                       |D1 & D2
            Summary|incorrect result for        |`is(<uncompilable
                   |"is(BadTemplate!())"        |template>)` is true and
                   |                            |doesn't gap errors if not
                   |                            |in a function
         OS/Version|Linux                       |All



---
This code compiles:
---
struct S() { void f() { error; } }

void f() {
    static assert(!is(S!())); // passes
    static if(is(S!())) { }   // no errors
}
---

This bug is only for `is()` not in a function:
---
struct S() { void f() { error; } }

static assert(!is(S!())); // assertion fails
static if(is(S!())) { }   // Error: undefined identifier
---


 This is happening because compiling this()'s body is not necessary to determine
 the type. Not sure if this is a bug or not.
This is a bug because an assertion passes in a function and because of "undefined identifier" error with `static if`. Someone familiar with dmd internals, mark bug 3448 as a duplicate or show the difference between `is(...)` and `__traits(compiles, ...)` in context of this issue. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 01 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=965


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuclaw ubuntu.com



*** Issue 5352 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 24 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=965


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |davidl 126.com



*** Issue 2167 has been marked as a duplicate of this issue. ***

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