[dcl.attr.annotation] # 9 Declarations [[dcl]](./#dcl) ## 9.13 Attributes [[dcl.attr]](dcl.attr#annotation) ### 9.13.12 Annotations [dcl.attr.annotation] [1](#1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/declarations.tex#L10191) An annotation may be applied to any declaration of a type, type alias, variable, function, namespace, enumerator,[*base-specifier*](class.derived.general#nt:base-specifier "11.7.1 General [class.derived.general]"), or non-static data member[.](#1.sentence-1) [2](#2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/declarations.tex#L10202) Let E be the expressionstd​::​meta​::​reflect_constant([*constant-expression*](expr.const#nt:constant-expression "7.7 Constant expressions [expr.const]"))[.](#2.sentence-1) E shall be a constant expression; the result of E is the [*underlying constant*](#def:constant,underlying "9.13.12 Annotations [dcl.attr.annotation]") of the annotation[.](#2.sentence-2) [3](#3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/declarations.tex#L10208) Each [*annotation*](dcl.attr.grammar#nt:annotation "9.13.1 Attribute syntax and semantics [dcl.attr.grammar]") produces a unique annotation[.](#3.sentence-1) [4](#4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/declarations.tex#L10211) Substituting into an [*annotation*](dcl.attr.grammar#nt:annotation "9.13.1 Attribute syntax and semantics [dcl.attr.grammar]") is not in the immediate context[.](#4.sentence-1) [*Example [1](#example-1)*: [[=1]] void f();[[=2, =3, =2]] void g();void g [[=4, =2]] ();f has one annotation and g has five annotations[.](#4.sentence-2) These can be queried with metafunctions such as std​::​​meta​::​​annotations_of ([[meta.reflection.annotation]](meta.reflection.annotation "21.4.18 Annotation reflection"))[.](#4.sentence-3) — *end example*] [*Example [2](#example-2)*: template[[=T::type()]] void f(T t); void f(int); void g() { f(0); // OK f('0'); // error, substituting into the annotation results in an invalid expression} — *end example*]