View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0037848 | FPC | Documentation | public | 2020-09-30 23:27 | 2020-10-01 13:38 |
Reporter | Sven Barth | Assigned To | Michael Van Canneyt | ||
Priority | normal | Severity | minor | Reproducibility | N/A |
Status | resolved | Resolution | fixed | ||
Product Version | 3.2.0 | ||||
Fixed in Version | 3.3.1 | ||||
Summary | 0037848: Chapter about Generic type specialization promotes (fixed) bug as a feature | ||||
Description | At the end of chapter 8.3 Generic type specialization there is the following paragraph:Remark As of version 3.0, it is possible to make a forward definition of a generic class. In prior versions the compiler would generate an error if a forward declaration of a class was later defined as a generic specialization. This means that the following is now possible: {$mode objfpc} Type TMyClass = Class; // Other declarations TMyClass = specialize TList<T>; This is wrong. This was a bug and it's no longer allowed in 3.2.0. | ||||
Tags | generics | ||||
Fixed in Revision | 1756. | ||||
FPCOldBugId | |||||
FPCTarget | 3.2.2 | ||||
Attached Files |
|
|
Eh, I'm confused.... So, to recap: forward declarations of generic classes is not allowed ? |
|
The documentation shows a forward declaration of a specialization, not a generic and yes, those are not allowed. The forward declaration of a generic would look like this: type generic TTest<T> = class; generic TTest<T> = class(TObject) end; However this is not yet supported in FPC (there is a bug report for that with a patch, but it's not good enough as I had found out when testing it). |
|
Thank you for the clarification! Changed the remark to state that it is not allowed. |
Date Modified | Username | Field | Change |
---|---|---|---|
2020-09-30 23:27 | Sven Barth | New Issue | |
2020-09-30 23:27 | Sven Barth | Status | new => assigned |
2020-09-30 23:27 | Sven Barth | Assigned To | => Michael Van Canneyt |
2020-10-01 09:41 | Michael Van Canneyt | Note Added: 0126015 | |
2020-10-01 13:20 | Sven Barth | Note Added: 0126023 | |
2020-10-01 13:20 | Sven Barth | Tag Attached: generics | |
2020-10-01 13:20 | Sven Barth | Note Edited: 0126023 | View Revisions |
2020-10-01 13:21 | Sven Barth | Note Edited: 0126023 | View Revisions |
2020-10-01 13:38 | Michael Van Canneyt | Status | assigned => resolved |
2020-10-01 13:38 | Michael Van Canneyt | Resolution | open => fixed |
2020-10-01 13:38 | Michael Van Canneyt | Fixed in Version | => 3.3.1 |
2020-10-01 13:38 | Michael Van Canneyt | Fixed in Revision | => 1756. |
2020-10-01 13:38 | Michael Van Canneyt | FPCTarget | => 3.2.2 |
2020-10-01 13:38 | Michael Van Canneyt | Note Added: 0126024 |