Thread overview
[Issue 965] New: incorrect result for "is(BadTemplate!())"
Feb 15, 2007
d-bugmail
Aug 13, 2007
d-bugmail
Oct 28, 2009
Max Samukha
[Issue 965] `is(<uncompilable template>)` is true and doesn't gap errors if not in a function
Jan 01, 2012
Denis
Feb 24, 2012
Don
Nov 21, 2012
Don
February 15, 2007
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


This is a variation of issue #826

# class Templ(T){
#    this(){
#       unknown_identifier = 0;
#    }
# }
#
# static assert(false == is(Templ!(int)));

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


-- 

August 13, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=965





------- Comment #1 from bugzilla@digitalmars.com  2007-08-12 21:56 -------
This is happening because compiling this()'s body is not necessary to determine the type. Not sure if this is a bug or not.


-- 

October 28, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=965


Max Samukha <samukha@voliacable.com> changed:

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


--- Comment #2 from Max Samukha <samukha@voliacable.com> 2009-10-28 06:58:04 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: -------
January 01, 2012
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


--- Comment #3 from Denis <verylonglogin.reg@gmail.com> 2012-01-01 13:59:08 MSK ---
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
---

(In reply to comment #1)
> 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: -------
February 24, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=965


Don <clugdbug@yahoo.com.au> changed:

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


--- Comment #4 from Don <clugdbug@yahoo.com.au> 2012-02-24 00:38:36 PST ---
*** 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: -------
November 21, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=965


Don <clugdbug@yahoo.com.au> changed:

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


--- Comment #5 from Don <clugdbug@yahoo.com.au> 2012-11-21 00:47:55 PST ---
*** 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: -------