Skip to content

[dcl.attr.annotation] Which annotations are unique? #825

@brevzin

Description

@brevzin

Reference (section label): [dcl.attr.annotation]

Issue description:

Consider the example

template<int> int x [[=1]];
template<int A> int y [[=A]];
static_assert(annotations_of(^^x<0>) == annotations_of(^^x<1>)); // #1
static_assert(annotations_of(^^y<0>) == annotations_of(^^y<1>)); // #2

[dcl.attr.annotation] currently says that:

Each annotation produces a unique annotation.

Which suggests a grammatical uniqueness — that there is only one [[=1]] (and thus #1 holds) and nonsensically that there is only one [[=A]] (which would imply that #2 holds). We probably need to say something about how instantiation produces unique annotations as well, so that neither static_assert holds — which is important if we ever want to allow something like parent_of(annotations_of(^^x<0>)[0]) == ^^x<0>.

I don't know how to word that, where, but would probably help to include the simpler example in the wording:

template<int> int x [[=1]];
static_assert(annotations_of(^^x<0>) != annotations_of(^^x<1>)); // ok

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