www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 934] New: forward reference by pragma(msg) in template: "mtype.c:550: virtual Expression* Type::getProperty(Loc, Identifier*): Assertion `deco' failed"

reply d-bugmail puremagic.com writes:
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.


-- 
Feb 06 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=934






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


-- 
Apr 05 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
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"              |





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


-- 
Apr 16 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=934


clugdbug yahoo.com.au changed:

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





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.


-- 
Apr 19 2009
prev sibling parent d-bugmail puremagic.com writes:
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





Fixed DMD2.030 and 1.045

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