Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Compiler/Delphi/Header Generation    [ Add a report in this area ]  
Report #:  73545   Status: Open
DCC doesn't correctly emit forward declarations of generic classes
Project:  C++Builder Build #:  12.0.3210.17555
Version:    12.1 Submitted By:   Moritz Beutel
Report Type:  Basic functionality failure Date Reported:  5/1/2009 5:09:49 AM
Severity:    Commonly encountered problem Last Updated: 3/20/2012 2:24:39 AM
Platform:    All versions Internal Tracking #:   269242
Resolution: None (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
The following code causes invalid header output to be generated:

// -----
unit qc73545;

interface

type
  TFoo<T> = class;

  TBar<T> = class
    FFoo: TFoo<T>;
  end;

  TFoo<T> = class
    FBar: TBar<T>;
  end;

implementation

end.
// -----

The header file (relevant parts):
// -----
template<typename T> class DELPHICLASS TBar__1;
template<typename T> class PASCALIMPLEMENTATION TBar__1 : public System::TObject
{

TFoo__1<T>* FFoo;

...
};

template<typename T> class DELPHICLASS TFoo__1;
template<typename T> class PASCALIMPLEMENTATION TFoo__1 : public System::TObject
{

TBar__1<T>* FBar;

...
};
// -----
Steps to Reproduce:
- Compile the following code (dcc32 -JPHN qc73545.pas):
// -----
unit qc73545;

interface

type
  TFoo<T> = class;

  TBar<T> = class
    FFoo: TFoo<T>;
  end;

  TFoo<T> = class
    FBar: TBar<T>;
  end;

implementation

end.
// -----

- Compile the generated header file with BCC (bcc32 -c -P qc73545.hpp).

Exp.: compiles:

Act.:
Error E2303 qc73545.hpp 32: Type name expected
Error E2139 qc73545.hpp 32: Declaration missing ;
Workarounds
None
Attachment
qc73545.zip
Comments

None

Server Response from: ETNACODE01