Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5845891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:29:58+00:00 2026-05-22T12:29:58+00:00

I run into what seems to be a very classical problem: An item and

  • 0

I run into what seems to be a very classical problem: An item and a collection class, both referencing each other, that require a forward declaration. I’m using Delphi 2010 with update 5.

This works well with non generic classes but I can’t workaround the E2086 error with generic types:

type
  // Forward declarations
  TMyElement = class; // E2086: Type 'TMyElement' is not yet completely defined

  TMyCollection<T:TMyElement> = class
    //
  end;

  TMyElement = class
    FParent: TMyCollection<TMyElement>;
  end;

The same issue happens when switching the class declaration order.

I didn’t found any reference to this issue here or in QualityCentral (other issues with E2086 were found, but not related to this use case)

The only workaround I have for now is to declare the parent as TObject, and cast it to the collection generic type when required (not a clean solution…)

How did you workaround this issue, or forward-declare your generic classes?

Thanks,

[Edit Oct 22, 2011] Follow up on QualityCentral:
I reported this bug in quality central here

This has been closed recently by EMB with the following resolution status:
Resolution: As designed
Resolved in build: 16.0.4152

I only have Delphi 2010. Could someone confirm that it has been fixed in Delphe XE2 Update1, or does it mean that it works ‘as expected’?

[Edit Oct 23, 2011] Final answer from EMB:
EMB confirmed today that using forward declaration of a generic type is not supported by the actual Delphi compiler. You can see their answer in QC, with the link provided above.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T12:29:59+00:00Added an answer on May 22, 2026 at 12:29 pm

    You can work around it by declaring an ancestor class:

    type
      TBaseElement = class
      end;
    
      TMyCollection<T: TBaseElement> = class
      end;
    
      TMyElement = class(TBaseElement)
      private
        FParent: TMyCollection<TBaseElement>;
      end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

it seems I have run into a problem with Internet Explorer 7. I have
I've run into a strange situation that seems to involve long text overflowing. I'm
I've recently started using GNU Screen but have run into a very annoying problem.
I seem to run into this very often. I need to build a Hash
I often run into the following problem. I work on some changes to a
I've run into a problem where I make changes to a few JavaScript files
I have run into an interesting bug where it appears that when you select
I run into similar codes like this all the time in aspx pages: <asp:CheckBox
I run into this quite often where a new page is supposedly tested and
Has anyone run into this error message before when using a timer on an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.