Skip to content

sv: give struct and union types a declaration identity for class specializations #1963

Closed

Description

@tignear

Class specializations are keyed by a spelling of the bound parameter types. A packed struct or union type carries its structure but no declaration identity, so two separately declared but identical types would give one key:

typedef struct packed { int x; } A;
typedef struct packed { int x; } B;
class C #(type T = int); static int count; endclass
// C#(A) and C#(B) are different specializations (IEEE 1800-2023 6.22.1, 8.25)

To avoid silently sharing static properties and handle identity between such specializations, #1796 rejects struct and union types as class type parameter values, as it already does for enumeration types (each enum declaration is a type of its own, 6.19).

Expected

Give aggregate (and enum) types a declaration identity that survives typedef aliasing (typedef A A2; names the same type as A), use it in the specialization key, and lift the rejection.

Found in a review of #1796.

Activity

  1. added 2 commits that reference this issue on Oct 28, 2026
    1117467
    73b74f2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions