Thread overview
[Issue 3168] New: Declaring structs as incomplete types no longer works
Jul 12, 2009
nfxjfg@gmail.com
Aug 06, 2009
Don
Aug 15, 2009
Stewart Gordon
Aug 15, 2009
Don
Aug 15, 2009
Stewart Gordon
Sep 03, 2009
Walter Bright
July 12, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3168

           Summary: Declaring structs as incomplete types no longer works
           Product: D
           Version: 1.046
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: nfxjfg@gmail.com


In dmd 1.045, you used to be able to declare structs like this:

>>
struct FT_RasterRec;
<<

This no longer works with dmd 1.046.
The error message is:
test.d(1): Error: struct jk.FT_RasterRec has forward references

Declaring structs like this is often done in C to define incomplete types, and is especially useful when porting C headers. Also, the new behavior in dmd 1.046 breaks old code.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 06, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3168


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch, rejects-valid
                 CC|                            |clugdbug@yahoo.com.au




--- Comment #1 from Don <clugdbug@yahoo.com.au>  2009-08-06 13:08:07 PDT ---
Patch: Change one line in struct.c line 64. (This makes it the same as the code
in D2).
---
void AggregateDeclaration::semantic2(Scope *sc)
{
    //printf("AggregateDeclaration::semantic2(%s)\n", toChars());
-    if (scope)
+    if (scope && members)
    {    error("has forward references");
    return;
    }

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 15, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3168


Stewart Gordon <smjg@iname.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg@iname.com




--- Comment #2 from Stewart Gordon <smjg@iname.com>  2009-08-15 06:31:57 PDT ---
What bug reports are there already for the fact that we have a "has forward references" error here in the code?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 15, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3168





--- Comment #3 from Don <clugdbug@yahoo.com.au>  2009-08-15 11:22:05 PDT ---
(In reply to comment #2)
> What bug reports are there already for the fact that we have a "has forward references" error here in the code?

I don't think there are any. This is a very simple regression, caused by a typo. It's unrelated to other forward reference errors.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 15, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3168





--- Comment #4 from Stewart Gordon <smjg@iname.com>  2009-08-15 12:23:39 PDT ---
(In reply to comment #3)
> (In reply to comment #2)
> > What bug reports are there already for the fact that we have a "has forward references" error here in the code?
> 
> I don't think there are any. This is a very simple regression, caused by a typo. It's unrelated to other forward reference errors.

Maybe, but it's clearly related to at least one other cause of the same forward reference error.  If it weren't, then any fix to this bug would cause the line

    error("has forward references");

to disappear completely.

So it's a matter of figuring out what else triggers this error.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 03, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3168


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED




--- Comment #5 from Walter Bright <bugzilla@digitalmars.com>  2009-09-03 13:29:20 PDT ---
Fixed dmd 1.047

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