View mode: basic / threaded / horizontal-split · Log in · Help
December 14, 2009
[Issue 3616] New: __traits(compiles) returns true for uncompilable code due to static assert
http://d.puremagic.com/issues/show_bug.cgi?id=3616

          Summary: __traits(compiles) returns true for uncompilable code
                   due to static assert
          Product: D
          Version: 2.036
         Platform: Other
       OS/Version: Linux
           Status: NEW
         Severity: normal
         Priority: P2
        Component: DMD
       AssignedTo: nobody@puremagic.com
       ReportedBy: lutger.blijdestijn@gmail.com


--- Comment #0 from Lutger <lutger.blijdestijn@gmail.com> 2009-12-14 10:51:43 PST ---
void foo()
{
   static assert(false);
}

void main()
{
   static assert( __traits(compiles, foo()) == false );
}

The assert fails, but should not. Looks similar to bug 3448.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 01, 2012
[Issue 3616] __traits(compiles) returns true for uncompilable code due to static assert
http://d.puremagic.com/issues/show_bug.cgi?id=3616


Denis <verylonglogin.reg@gmail.com> changed:

          What    |Removed                     |Added
----------------------------------------------------------------------------
            Status|NEW                         |RESOLVED
                CC|                            |verylonglogin.reg@gmail.com
        Resolution|                            |INVALID


--- Comment #1 from Denis <verylonglogin.reg@gmail.com> 2012-01-01 13:37:37 MSK ---
Assertion in `foo` should fail because `foo` is a regular function and compiles
independently of assertion in `main`. This code compiles:
---
void foo()() { static assert(false); }
void main()  { static assert(!__traits(compiles, foo!()())); }
---

Note, that due to bug 3448 __traits(compiles) works correctly only if it is in
a function.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Top | Discussion index | About this forum | D home