Thread overview
[Issue 934] New: forward reference by pragma(msg) in template: "mtype.c:550: virtual Expression* Type::getProperty(Loc, Identifier*): Assertion `deco' failed"
Feb 06, 2007
d-bugmail
Apr 05, 2007
d-bugmail
[Issue 934] Segfault taking mangleof a forward reference in a template.
Apr 16, 2009
d-bugmail
Apr 20, 2009
d-bugmail
May 14, 2009
Don
February 06, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=934

           Summary: forward reference by pragma(msg) in template:
                    "mtype.c:550: virtual Expression* Type::getProperty(Loc,
                    Identifier*): Assertion `deco' failed"
           Product: D
           Version: 1.00
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: fvbommel@wxs.nl


-----
urxae@urxae:~/tmp$ cat test.d
template Templ(T) {
    pragma(msg, Type.mangleof);
    alias T Type;
}

void main() {
    Templ!(int).Type x;  // instantiate
}
urxae@urxae:~/tmp$ dmd test.d
dmd: mtype.c:550: virtual Expression* Type::getProperty(Loc, Identifier*):
Assertion `deco' failed.
Aborted (core dumped)
-----

Saw this first in DMD v1.005 (not in bugzilla yet), but it fails with v1.00 as
well.


-- 

April 05, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=934





------- Comment #1 from thomas-dloop@kuehne.cn  2007-04-05 11:39 -------
Added to DStress as http://dstress.kuehne.cn/compile/p/pragma_msg_02_A.d http://dstress.kuehne.cn/compile/p/pragma_msg_02_B.d


-- 

April 16, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=934


clugdbug@yahoo.com.au changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|forward reference by        |Segfault taking mangleof a
                   |pragma(msg) in template:    |forward reference in a
                   |"mtype.c:550: virtual       |template.
                   |Expression*                 |
                   |Type::getProperty(Loc,      |
                   |Identifier*): Assertion     |
                   |`deco' failed"              |




------- Comment #2 from clugdbug@yahoo.com.au  2009-04-16 04:05 -------
Actually it's nothing to do with pragma(msg). It's the mangleof which is the problem. Change it to .stringof and problem disappears.

template Templ(T) {
const char [] XXX = Type.mangleof;
    alias T Type;
}

void main() {
    Templ!(int).Type x;  // instantiate
}
====================
Segfaults on DMD2.028.
assert mtype.c(1272) deco
<segfault>

DMD1.042
Assertion failure: 'deco' on line 576 in file 'mtype.c'

abnormal program termination


-- 

April 20, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=934


clugdbug@yahoo.com.au changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch




------- Comment #3 from clugdbug@yahoo.com.au  2009-04-20 01:55 -------
PATCH: DMD2.028 on mytype.c line 1272, replace assert(deco); with:
        if (!deco) {
                error(loc, ".mangleof forward reference");
                return new StringExp(loc, "ERROR", 5, 'c');
        }
        ---
I was surprised to find that in most cases, this error doesn't appear -- seems
the compiler absorbs the error and retries in the next semantic pass, and then
the code works correctly. In other words, it completely fixes the bug in D2.
From the line number, seems it's a different cause in D1.


-- 

May 14, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=934


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug@yahoo.com.au
         Resolution|                            |FIXED




--- Comment #4 from Don <clugdbug@yahoo.com.au>  2009-05-14 05:21:07 PDT ---
Fixed DMD2.030 and 1.045

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