www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3448] New: __traits(compiles) returns true for a non-compilable template instantiation

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

           Summary: __traits(compiles) returns true for a non-compilable
                    template instantiation
           Product: D
           Version: 2.035
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: samukha voliacable.com


--- Comment #0 from Max Samukha <samukha voliacable.com> 2009-10-29 04:48:13
PDT ---
template Bar()
{
    void Bar()
    {
        error;
    }
}

template Foo()
{
    enum Foo = __traits(compiles, Bar!());
}

static assert(!Foo!());

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


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies gmail.com


--- Comment #1 from yebblies <yebblies gmail.com> 2011-06-12 15:27:30 PDT ---
This seems to have the same root cause as bug 965

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 12 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3448


Denis <verylonglogin.reg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |verylonglogin.reg gmail.com


--- Comment #2 from Denis <verylonglogin.reg gmail.com> 2012-01-01 13:20:05 MSK
---
Just a bit smaller testcase:
---
void t()() { error; }

static assert(!__traits(compiles, t!()())); // assertion fails
static if(__traits(compiles, t!()())) { }   // Error: undefined identifier
---

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


Denis <verylonglogin.reg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|__traits(compiles) returns  |__traits(compiles) not in a
                   |true for a non-compilable   |function returns true for a
                   |template instantiation      |non-compilable template
                   |                            |instantiation


--- Comment #3 from Denis <verylonglogin.reg gmail.com> 2012-01-01 13:35:40 MSK
---
This bug is only for `static assert/if` not in a function:
---
void t()() { error; }

void f() {
    static assert(!__traits(compiles, t!()())); // passes
    static if(__traits(compiles, t!()())) { }   // no errors
}
---

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