[Issue 2679] Spurious "warning - " messages and erratic behaviour with is(typeof({void function}()))

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Feb 21 13:45:18 PST 2009


http://d.puremagic.com/issues/show_bug.cgi?id=2679


smjg at iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg at iname.com
           Keywords|                            |diagnostic, rejects-valid
         OS/Version|Linux                       |All
            Summary|Spurious "warning - "       |Spurious "warning - "
                   |messages output to console  |messages and erratic
                   |                            |behaviour with
                   |                            |is(typeof({void
                   |                            |function}()))
            Version|unspecified                 |1.040




------- Comment #1 from smjg at iname.com  2009-02-21 15:45 -------
There's something really fishy going on here.
----------
C:\Users\Stewart\Documents\Programming\D\Tests\bugs>type bz2679a.d
bool valid = is(typeof({long s; short t = s;}()));

C:\Users\Stewart\Documents\Programming\D\Tests\bugs>dmd -c bz2679a.d

C:\Users\Stewart\Documents\Programming\D\Tests\bugs>dmd -w -c bz2679a.d
warning -
C:\Users\Stewart\Documents\Programming\D\Tests\bugs>type bz2679b.d
static assert (is(typeof({long s; short t = s;}())));

C:\Users\Stewart\Documents\Programming\D\Tests\bugs>dmd -c bz2679b.d

C:\Users\Stewart\Documents\Programming\D\Tests\bugs>dmd -w -c bz2679b.d
warning - bz2679b.d(1): static assert  is false

C:\Users\Stewart\Documents\Programming\D\Tests\bugs>type bz2679c.d
static assert (!is(typeof({long s; short t = s;}())));

C:\Users\Stewart\Documents\Programming\D\Tests\bugs>dmd -c bz2679c.d
bz2679c.d(1): static assert  is false

C:\Users\Stewart\Documents\Programming\D\Tests\bugs>dmd -w -c bz2679c.d
warning -
C:\Users\Stewart\Documents\Programming\D\Tests\bugs>type bz2679d.d
pragma(msg, typeof({long s; short t = s;}()).stringof);

C:\Users\Stewart\Documents\Programming\D\Tests\bugs>dmd -c bz2679d.d
void

C:\Users\Stewart\Documents\Programming\D\Tests\bugs>dmd -w -c bz2679d.d
warning - bz2679d.d(1): Error: implicit conversion of expression (s) of type
lon
g to short can cause loss of data
void
----------

Not only is it spitting out that message, but the diagnosed validity of the
expression inside the typeof seems to depend on a few things.  Really, the
expression is valid, but when warnings are enabled it gets mixed up.  Tested on
both 1.040 and 2.025 (Windows) with same effect.


-- 



More information about the Digitalmars-d-bugs mailing list