www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1738] New: Error on struct with on line number

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

           Summary: Error on struct with on line number
           Product: D
           Version: 1.024
          Platform: PC
               URL: http://www.digitalmars.com/webnews/newsgroups.php?art_gr
                    oup=digitalmars.D&article_id=63859
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: technocrat7 gmail.com


I narrowed down the error without a line number that Dan saw in Walnut. I don't
know that DMD is reject code that is invalid in Dan's case, but obviously the
code in my reduced example is invalid code. The error message should be
improved to show where the error occurs.

Example:
<code>
struct MyStruct {
}

static const MyStruct
        FALSE = { b:false };
</code>

Error Message:

Error: 'b' is not a member of 'MyStruct'
(no line number provided by DMD)


-- 
Dec 17 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1738


technocrat7 gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Error on struct with on line|Error on struct without line
                   |number                      |number





I fixed the summary.


-- 
Dec 17 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1738






Umm... well, this issue is blocking any development on my program with any
compiler after 1.020 (whatever changed, happened in 1.021)

My code shows:

struct Value {
  union {
   bool b;
   int i;
   ...
  }
}

static const Value
   UNDEFINED = ...
   FALSE = { b:false ... }
   ...

I get an error message which is completely not useful.  It just says "b is not
a member of Value"; which it clearly is.

Please help.
Regards,
Dan


-- 
Dec 31 2007
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1738


technocrat7 gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED





DMD 1.025 seems to have fixed the missing line number bug. My test case now
yields a filename and line number:

<quote>
test1.d(14): Error: 'b' is not a member of 'MyStruct'
</quote>

It also may have fixed Dan's code since this snippet now compiles, too:
<code>
struct Value {
  union {
   bool b;
   int i;
  }
}

static const Value
   FALSE = { b:false};
</code>

(But I think that snippet seemed to compile with DMD 1.024, too.)

Dan, if you continue to have related problems, you should probably post a new
bug report with a new description, test case, etc., since the description and
keyword of this bug report doesn't apply anymore since the line number is
provided for invalid code.


-- 
Jan 02 2008