From Jason Turner

[dcl.attr]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp9f2f8s8q/{from.md → to.md} +141 -85
tmp/tmp9f2f8s8q/{from.md → to.md} RENAMED
@@ -113,39 +113,53 @@ contained in an *attribute-token*, it is considered an identifier. No
113
  name lookup [[basic.lookup]] is performed on any of the identifiers
114
  contained in an *attribute-token*. The *attribute-token* determines
115
  additional requirements on the *attribute-argument-clause* (if any).
116
 
117
  Each *attribute-specifier-seq* is said to *appertain* to some entity or
118
- statement, identified by the syntactic context where it appears (
119
- [[stmt.stmt]], [[dcl.dcl]], [[dcl.decl]]). If an
120
  *attribute-specifier-seq* that appertains to some entity or statement
121
  contains an *attribute* or *alignment-specifier* that is not allowed to
122
  apply to that entity or statement, the program is ill-formed. If an
123
  *attribute-specifier-seq* appertains to a friend declaration
124
  [[class.friend]], that declaration shall be a definition.
125
 
126
  [*Note 3*: An *attribute-specifier-seq* cannot appeartain to an
127
  explicit instantiation [[temp.explicit]]. — *end note*]
128
 
129
  For an *attribute-token* (including an *attribute-scoped-token*) not
130
- specified in this document, the behavior is *implementation-defined*.
131
- Any *attribute-token* that is not recognized by the implementation is
132
- ignored. An *attribute-token* is reserved for future standardization if
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
 
134
  - it is not an *attribute-scoped-token* and is not specified in this
135
  document, or
136
  - it is an *attribute-scoped-token* and its *attribute-namespace* is
137
  `std` followed by zero or more digits.
138
 
139
- [*Note 4*: Each implementation should choose a distinctive name for the
140
- *attribute-namespace* in an *attribute-scoped-token*. — *end note*]
141
 
142
  Two consecutive left square bracket tokens shall appear only when
143
  introducing an *attribute-specifier* or within the *balanced-token-seq*
144
  of an *attribute-argument-clause*.
145
 
146
- [*Note 5*: If two consecutive left square brackets appear where an
147
  *attribute-specifier* is not allowed, the program is ill-formed even if
148
  the brackets match an alternative grammar production. — *end note*]
149
 
150
  [*Example 2*:
151
 
@@ -250,23 +264,58 @@ alignas(float)
250
  extern unsigned char c[sizeof(double)]; // error: different alignment in declaration
251
  ```
252
 
253
  — *end example*]
254
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
255
  ### Carries dependency attribute <a id="dcl.attr.depend">[[dcl.attr.depend]]</a>
256
 
257
  The *attribute-token* `carries_dependency` specifies dependency
258
- propagation into and out of functions. It shall appear at most once in
259
- each *attribute-list* and no *attribute-argument-clause* shall be
260
- present. The attribute may be applied to the *declarator-id* of a
261
- *parameter-declaration* in a function declaration or lambda, in which
262
- case it specifies that the initialization of the parameter carries a
263
- dependency to [[intro.multithread]] each lvalue-to-rvalue conversion
264
- [[conv.lval]] of that object. The attribute may also be applied to the
265
- *declarator-id* of a function declaration, in which case it specifies
266
- that the return value, if any, carries a dependency to the evaluation of
267
- the function call expression.
268
 
269
  The first declaration of a function shall specify the
270
  `carries_dependency` attribute for its *declarator-id* if any
271
  declaration of the function specifies the `carries_dependency`
272
  attribute. Furthermore, the first declaration of a function shall
@@ -278,11 +327,11 @@ declaration in one translation unit and the same function or one of its
278
  parameters is declared without the `carries_dependency` attribute in its
279
  first declaration in another translation unit, the program is
280
  ill-formed, no diagnostic required.
281
 
282
  [*Note 1*: The `carries_dependency` attribute does not change the
283
- meaning of the program, but may result in generation of more efficient
284
  code. — *end note*]
285
 
286
  [*Example 1*:
287
 
288
  ``` cpp
@@ -334,28 +383,28 @@ The *attribute-token* `deprecated` can be used to mark names and
334
  entities whose use is still allowed, but is discouraged for some reason.
335
 
336
  [*Note 1*: In particular, `deprecated` is appropriate for names and
337
  entities that are deemed obsolescent or unsafe. — *end note*]
338
 
339
- It shall appear at most once in each *attribute-list*. An
340
- *attribute-argument-clause* may be present and, if present, it shall
341
  have the form:
342
 
343
  ``` bnf
344
  '(' string-literal ')'
345
  ```
346
 
347
- [*Note 2*: The *string-literal* in the *attribute-argument-clause*
348
- could be used to explain the rationale for deprecation and/or to suggest
349
- a replacing entity. — *end note*]
350
 
351
  The attribute may be applied to the declaration of a class, a
352
  *typedef-name*, a variable, a non-static data member, a function, a
353
- namespace, an enumeration, an enumerator, or a template specialization.
 
354
 
355
- A name or entity declared without the `deprecated` attribute can later
356
- be redeclared with the attribute and vice-versa.
357
 
358
  [*Note 3*: Thus, an entity initially declared without the attribute can
359
  be marked as deprecated by a subsequent redeclaration. However, after an
360
  entity is marked as deprecated, later redeclarations do not un-deprecate
361
  the entity. — *end note*]
@@ -372,21 +421,20 @@ provided within the *attribute-argument-clause* of any `deprecated`
372
  attribute applied to the name or entity.
373
 
374
  ### Fallthrough attribute <a id="dcl.attr.fallthrough">[[dcl.attr.fallthrough]]</a>
375
 
376
  The *attribute-token* `fallthrough` may be applied to a null statement
377
- [[stmt.expr]]; such a statement is a fallthrough statement. The
378
- *attribute-token* `fallthrough` shall appear at most once in each
379
- *attribute-list* and no *attribute-argument-clause* shall be present. A
380
- fallthrough statement may only appear within an enclosing `switch`
381
- statement [[stmt.switch]]. The next statement that would be executed
382
- after a fallthrough statement shall be a labeled statement whose label
383
- is a case label or default label for the same `switch` statement and, if
384
- the fallthrough statement is contained in an iteration statement, the
385
- next statement shall be part of the same execution of the substatement
386
- of the innermost enclosing iteration statement. The program is
387
- ill-formed if there is no such statement.
388
 
389
  *Recommended practice:* The use of a fallthrough statement should
390
  suppress a warning that an implementation might otherwise issue for a
391
  case or default label that is reachable from another case or default
392
  label along some path of execution. Implementations should issue a
@@ -426,15 +474,14 @@ void f(int n) {
426
  — *end example*]
427
 
428
  ### Likelihood attributes <a id="dcl.attr.likelihood">[[dcl.attr.likelihood]]</a>
429
 
430
  The *attribute-token*s `likely` and `unlikely` may be applied to labels
431
- or statements. The *attribute-token*s `likely` and `unlikely` shall
432
- appear at most once in each *attribute-list* and no
433
- *attribute-argument-clause* shall be present. The *attribute-token*
434
- `likely` shall not appear in an *attribute-specifier-seq* that contains
435
- the *attribute-token* `unlikely`.
436
 
437
  *Recommended practice:* The use of the `likely` attribute is intended to
438
  allow implementations to optimize for the case where paths of execution
439
  including it are arbitrarily more likely than any alternative path of
440
  execution that does not include such an attribute on a statement or
@@ -474,12 +521,12 @@ int f(int n) {
474
  — *end example*]
475
 
476
  ### Maybe unused attribute <a id="dcl.attr.unused">[[dcl.attr.unused]]</a>
477
 
478
  The *attribute-token* `maybe_unused` indicates that a name or entity is
479
- possibly intentionally unused. It shall appear at most once in each
480
- *attribute-list* and no *attribute-argument-clause* shall be present.
481
 
482
  The attribute may be applied to the declaration of a class, a
483
  *typedef-name*, a variable (including a structured binding declaration),
484
  a non-static data member, a function, an enumeration, or an enumerator.
485
 
@@ -509,13 +556,12 @@ Implementations should not warn that `b` is unused, whether or not
509
 
510
  — *end example*]
511
 
512
  ### Nodiscard attribute <a id="dcl.attr.nodiscard">[[dcl.attr.nodiscard]]</a>
513
 
514
- The *attribute-token* `nodiscard` may be applied to the *declarator-id*
515
- in a function declaration or to the declaration of a class or
516
- enumeration. It shall appear at most once in each *attribute-list*. An
517
  *attribute-argument-clause* may be present and, if present, shall have
518
  the form:
519
 
520
  ``` bnf
521
  '(' string-literal ')'
@@ -538,14 +584,15 @@ type marked `nodiscard` in a reachable declaration. A *nodiscard call*
538
  is either
539
 
540
  - a function call expression [[expr.call]] that calls a function
541
  declared `nodiscard` in a reachable declaration or whose return type
542
  is a nodiscard type, or
543
- - an explicit type conversion ([[expr.type.conv]],
544
- [[expr.static.cast]], [[expr.cast]]) that constructs an object through
545
- a constructor declared `nodiscard` in a reachable declaration, or that
546
- initializes an object of a nodiscard type.
 
547
 
548
  *Recommended practice:* Appearance of a nodiscard call as a
549
  potentially-evaluated discarded-value expression [[expr.prop]] is
550
  discouraged unless explicitly cast to `void`. Implementations should
551
  issue a warning in such cases.
@@ -587,13 +634,12 @@ void f() { foo(); } // warning not encouraged: not a nodiscard call,
587
  — *end example*]
588
 
589
  ### Noreturn attribute <a id="dcl.attr.noreturn">[[dcl.attr.noreturn]]</a>
590
 
591
  The *attribute-token* `noreturn` specifies that a function does not
592
- return. It shall appear at most once in each *attribute-list* and no
593
- *attribute-argument-clause* shall be present. The attribute may be
594
- applied to the *declarator-id* in a function declaration. The first
595
  declaration of a function shall specify the `noreturn` attribute if any
596
  declaration of that function specifies the `noreturn` attribute. If a
597
  function is declared with the `noreturn` attribute in one translation
598
  unit and the same function is declared without the `noreturn` attribute
599
  in another translation unit, the program is ill-formed, no diagnostic
@@ -625,12 +671,11 @@ function marked `[[noreturn]]` might return.
625
  — *end example*]
626
 
627
  ### No unique address attribute <a id="dcl.attr.nouniqueaddr">[[dcl.attr.nouniqueaddr]]</a>
628
 
629
  The *attribute-token* `no_unique_address` specifies that a non-static
630
- data member is a potentially-overlapping subobject [[intro.object]]. It
631
- shall appear at most once in each *attribute-list* and no
632
  *attribute-argument-clause* shall be present. The attribute may
633
  appertain to a non-static data member other than a bit-field.
634
 
635
  [*Note 1*: The non-static data member can share the address of another
636
  non-static data member or that of a base class, and any padding that
@@ -666,22 +711,19 @@ Here, `hasher`, `pred`, and `alloc` could have the same address as
666
  [basic.fundamental]: basic.md#basic.fundamental
667
  [basic.life]: basic.md#basic.life
668
  [basic.link]: basic.md#basic.link
669
  [basic.lookup]: basic.md#basic.lookup
670
  [basic.lookup.argdep]: basic.md#basic.lookup.argdep
671
- [basic.lookup.classref]: basic.md#basic.lookup.classref
672
  [basic.lookup.elab]: basic.md#basic.lookup.elab
 
673
  [basic.lookup.qual]: basic.md#basic.lookup.qual
674
  [basic.lookup.udir]: basic.md#basic.lookup.udir
675
  [basic.lookup.unqual]: basic.md#basic.lookup.unqual
676
  [basic.namespace]: #basic.namespace
677
- [basic.scope]: basic.md#basic.scope
678
- [basic.scope.block]: basic.md#basic.scope.block
679
- [basic.scope.declarative]: basic.md#basic.scope.declarative
680
  [basic.scope.namespace]: basic.md#basic.scope.namespace
681
- [basic.scope.param]: basic.md#basic.scope.param
682
- [basic.scope.pdecl]: basic.md#basic.scope.pdecl
683
  [basic.start]: basic.md#basic.start
684
  [basic.start.dynamic]: basic.md#basic.start.dynamic
685
  [basic.start.static]: basic.md#basic.start.static
686
  [basic.stc]: basic.md#basic.stc
687
  [basic.stc.auto]: basic.md#basic.stc.auto
@@ -689,17 +731,15 @@ Here, `hasher`, `pred`, and `alloc` could have the same address as
689
  [basic.stc.dynamic.allocation]: basic.md#basic.stc.dynamic.allocation
690
  [basic.stc.dynamic.deallocation]: basic.md#basic.stc.dynamic.deallocation
691
  [basic.stc.static]: basic.md#basic.stc.static
692
  [basic.stc.thread]: basic.md#basic.stc.thread
693
  [basic.type.qualifier]: basic.md#basic.type.qualifier
694
- [basic.types]: basic.md#basic.types
695
  [class]: class.md#class
696
  [class.access]: class.md#class.access
 
697
  [class.base.init]: class.md#class.base.init
698
  [class.bit]: class.md#class.bit
699
- [class.compare.default]: class.md#class.compare.default
700
- [class.conv]: class.md#class.conv
701
  [class.conv.ctor]: class.md#class.conv.ctor
702
  [class.conv.fct]: class.md#class.conv.fct
703
  [class.copy.assign]: class.md#class.copy.assign
704
  [class.copy.ctor]: class.md#class.copy.ctor
705
  [class.copy.elision]: class.md#class.copy.elision
@@ -709,11 +749,12 @@ Here, `hasher`, `pred`, and `alloc` could have the same address as
709
  [class.expl.init]: class.md#class.expl.init
710
  [class.friend]: class.md#class.friend
711
  [class.inhctor.init]: class.md#class.inhctor.init
712
  [class.init]: class.md#class.init
713
  [class.mem]: class.md#class.mem
714
- [class.member.lookup]: class.md#class.member.lookup
 
715
  [class.mfct]: class.md#class.mfct
716
  [class.mi]: class.md#class.mi
717
  [class.name]: class.md#class.name
718
  [class.pre]: class.md#class.pre
719
  [class.qual]: basic.md#class.qual
@@ -724,10 +765,12 @@ Here, `hasher`, `pred`, and `alloc` could have the same address as
724
  [class.union.anon]: class.md#class.union.anon
725
  [class.virtual]: class.md#class.virtual
726
  [conv]: expr.md#conv
727
  [conv.array]: expr.md#conv.array
728
  [conv.func]: expr.md#conv.func
 
 
729
  [conv.lval]: expr.md#conv.lval
730
  [conv.prom]: expr.md#conv.prom
731
  [conv.ptr]: expr.md#conv.ptr
732
  [conv.qual]: expr.md#conv.qual
733
  [conv.rval]: expr.md#conv.rval
@@ -736,10 +779,11 @@ Here, `hasher`, `pred`, and `alloc` could have the same address as
736
  [dcl.align]: #dcl.align
737
  [dcl.ambig.res]: #dcl.ambig.res
738
  [dcl.array]: #dcl.array
739
  [dcl.asm]: #dcl.asm
740
  [dcl.attr]: #dcl.attr
 
741
  [dcl.attr.depend]: #dcl.attr.depend
742
  [dcl.attr.deprecated]: #dcl.attr.deprecated
743
  [dcl.attr.fallthrough]: #dcl.attr.fallthrough
744
  [dcl.attr.grammar]: #dcl.attr.grammar
745
  [dcl.attr.likelihood]: #dcl.attr.likelihood
@@ -749,10 +793,11 @@ Here, `hasher`, `pred`, and `alloc` could have the same address as
749
  [dcl.attr.unused]: #dcl.attr.unused
750
  [dcl.constexpr]: #dcl.constexpr
751
  [dcl.constinit]: #dcl.constinit
752
  [dcl.dcl]: #dcl.dcl
753
  [dcl.decl]: #dcl.decl
 
754
  [dcl.enum]: #dcl.enum
755
  [dcl.fct]: #dcl.fct
756
  [dcl.fct.def]: #dcl.fct.def
757
  [dcl.fct.def.coroutine]: #dcl.fct.def.coroutine
758
  [dcl.fct.def.default]: #dcl.fct.def.default
@@ -761,80 +806,92 @@ Here, `hasher`, `pred`, and `alloc` could have the same address as
761
  [dcl.fct.default]: #dcl.fct.default
762
  [dcl.fct.spec]: #dcl.fct.spec
763
  [dcl.friend]: #dcl.friend
764
  [dcl.init]: #dcl.init
765
  [dcl.init.aggr]: #dcl.init.aggr
 
766
  [dcl.init.list]: #dcl.init.list
767
  [dcl.init.ref]: #dcl.init.ref
768
  [dcl.init.string]: #dcl.init.string
769
  [dcl.inline]: #dcl.inline
770
  [dcl.link]: #dcl.link
771
  [dcl.meaning]: #dcl.meaning
 
772
  [dcl.mptr]: #dcl.mptr
773
  [dcl.name]: #dcl.name
774
  [dcl.pre]: #dcl.pre
775
  [dcl.ptr]: #dcl.ptr
776
  [dcl.ref]: #dcl.ref
777
  [dcl.spec]: #dcl.spec
778
  [dcl.spec.auto]: #dcl.spec.auto
 
 
779
  [dcl.stc]: #dcl.stc
780
  [dcl.struct.bind]: #dcl.struct.bind
781
  [dcl.type]: #dcl.type
782
  [dcl.type.auto.deduct]: #dcl.type.auto.deduct
783
  [dcl.type.class.deduct]: #dcl.type.class.deduct
784
  [dcl.type.cv]: #dcl.type.cv
785
  [dcl.type.decltype]: #dcl.type.decltype
786
  [dcl.type.elab]: #dcl.type.elab
 
787
  [dcl.type.simple]: #dcl.type.simple
788
  [dcl.typedef]: #dcl.typedef
789
  [depr.volatile.type]: future.md#depr.volatile.type
790
  [enum]: #enum
791
  [enum.udecl]: #enum.udecl
792
  [except.ctor]: except.md#except.ctor
793
  [except.handle]: except.md#except.handle
 
794
  [except.spec]: except.md#except.spec
795
  [except.throw]: except.md#except.throw
796
  [expr.alignof]: expr.md#expr.alignof
797
  [expr.ass]: expr.md#expr.ass
798
  [expr.await]: expr.md#expr.await
799
  [expr.call]: expr.md#expr.call
800
  [expr.cast]: expr.md#expr.cast
 
801
  [expr.const]: expr.md#expr.const
802
  [expr.const.cast]: expr.md#expr.const.cast
803
  [expr.mptr.oper]: expr.md#expr.mptr.oper
804
  [expr.new]: expr.md#expr.new
805
  [expr.post.incr]: expr.md#expr.post.incr
806
  [expr.pre.incr]: expr.md#expr.pre.incr
 
807
  [expr.prim.lambda]: expr.md#expr.prim.lambda
808
  [expr.prim.this]: expr.md#expr.prim.this
809
  [expr.prop]: expr.md#expr.prop
810
  [expr.ref]: expr.md#expr.ref
811
  [expr.static.cast]: expr.md#expr.static.cast
812
  [expr.sub]: expr.md#expr.sub
813
  [expr.type.conv]: expr.md#expr.type.conv
814
  [expr.unary]: expr.md#expr.unary
815
  [expr.unary.op]: expr.md#expr.unary.op
816
  [expr.yield]: expr.md#expr.yield
 
 
817
  [intro.compliance]: intro.md#intro.compliance
818
  [intro.execution]: basic.md#intro.execution
819
  [intro.multithread]: basic.md#intro.multithread
820
  [intro.object]: basic.md#intro.object
821
- [lex.charset]: lex.md#lex.charset
822
  [lex.digraph]: lex.md#lex.digraph
823
  [lex.key]: lex.md#lex.key
824
  [lex.name]: lex.md#lex.name
825
  [lex.string]: lex.md#lex.string
826
  [module.interface]: module.md#module.interface
 
 
827
  [namespace.alias]: #namespace.alias
828
  [namespace.def]: #namespace.def
829
- [namespace.memdef]: #namespace.memdef
830
  [namespace.qual]: basic.md#namespace.qual
831
  [namespace.udecl]: #namespace.udecl
832
  [namespace.udir]: #namespace.udir
833
  [namespace.unnamed]: #namespace.unnamed
834
  [over]: over.md#over
835
  [over.binary]: over.md#over.binary
 
836
  [over.match]: over.md#over.match
837
  [over.match.best]: over.md#over.match.best
838
  [over.match.class.deduct]: over.md#over.match.class.deduct
839
  [over.match.conv]: over.md#over.match.conv
840
  [over.match.copy]: over.md#over.match.copy
@@ -844,42 +901,44 @@ Here, `hasher`, `pred`, and `alloc` could have the same address as
844
  [over.match.ref]: over.md#over.match.ref
845
  [over.match.viable]: over.md#over.match.viable
846
  [over.oper]: over.md#over.oper
847
  [over.sub]: over.md#over.sub
848
  [special]: class.md#special
 
849
  [stmt.ambig]: stmt.md#stmt.ambig
850
  [stmt.dcl]: stmt.md#stmt.dcl
851
  [stmt.expr]: stmt.md#stmt.expr
852
  [stmt.if]: stmt.md#stmt.if
853
  [stmt.iter]: stmt.md#stmt.iter
854
- [stmt.label]: stmt.md#stmt.label
855
- [stmt.pre]: stmt.md#stmt.pre
856
  [stmt.return]: stmt.md#stmt.return
857
  [stmt.return.coroutine]: stmt.md#stmt.return.coroutine
858
  [stmt.select]: stmt.md#stmt.select
859
  [stmt.stmt]: stmt.md#stmt.stmt
860
  [stmt.switch]: stmt.md#stmt.switch
861
  [support.runtime]: support.md#support.runtime
862
  [temp.arg.type]: temp.md#temp.arg.type
863
- [temp.class.spec]: temp.md#temp.class.spec
864
  [temp.deduct]: temp.md#temp.deduct
865
  [temp.deduct.call]: temp.md#temp.deduct.call
 
866
  [temp.deduct.guide]: temp.md#temp.deduct.guide
867
- [temp.dep]: temp.md#temp.dep
868
  [temp.expl.spec]: temp.md#temp.expl.spec
869
  [temp.explicit]: temp.md#temp.explicit
870
  [temp.fct]: temp.md#temp.fct
871
  [temp.inst]: temp.md#temp.inst
872
  [temp.local]: temp.md#temp.local
873
- [temp.mem]: temp.md#temp.mem
874
  [temp.names]: temp.md#temp.names
875
- [temp.over.link]: temp.md#temp.over.link
876
  [temp.param]: temp.md#temp.param
877
  [temp.pre]: temp.md#temp.pre
878
  [temp.res]: temp.md#temp.res
879
- [temp.spec]: temp.md#temp.spec
880
  [temp.variadic]: temp.md#temp.variadic
 
 
 
 
881
 
882
  [^1]: There is no special provision for a *decl-specifier-seq* that
883
  lacks a *type-specifier* or that has a *type-specifier* that only
884
  specifies *cv-qualifier*s. The “implicit int” rule of C is no longer
885
  supported.
@@ -907,25 +966,22 @@ Here, `hasher`, `pred`, and `alloc` could have the same address as
907
  reference type.
908
 
909
  [^8]: Implementations are permitted to provide additional predefined
910
  variables with names that are reserved to the implementation
911
  [[lex.name]]. If a predefined variable is not odr-used
912
- [[basic.def.odr]], its string value need not be present in the
913
  program image.
914
 
915
  [^9]: This set of values is used to define promotion and conversion
916
  semantics for the enumeration type. It does not preclude an
917
  expression of enumeration type from having a value that falls
918
  outside this range.
919
 
920
- [^10]: this implies that the name of the class or function is
921
- unqualified.
922
-
923
- [^11]: During name lookup in a class hierarchy, some ambiguities may be
924
  resolved by considering whether one member hides the other along
925
- some paths [[class.member.lookup]]. There is no such disambiguation
926
- when considering the set of names found as a result of following
927
- *using-directive*s.
928
 
929
- [^12]: A *using-declaration* with more than one *using-declarator* is
930
  equivalent to a corresponding sequence of *using-declaration*s with
931
  one *using-declarator* each.
 
113
  name lookup [[basic.lookup]] is performed on any of the identifiers
114
  contained in an *attribute-token*. The *attribute-token* determines
115
  additional requirements on the *attribute-argument-clause* (if any).
116
 
117
  Each *attribute-specifier-seq* is said to *appertain* to some entity or
118
+ statement, identified by the syntactic context where it appears
119
+ [[stmt.stmt]], [[dcl.dcl]], [[dcl.decl]]. If an
120
  *attribute-specifier-seq* that appertains to some entity or statement
121
  contains an *attribute* or *alignment-specifier* that is not allowed to
122
  apply to that entity or statement, the program is ill-formed. If an
123
  *attribute-specifier-seq* appertains to a friend declaration
124
  [[class.friend]], that declaration shall be a definition.
125
 
126
  [*Note 3*: An *attribute-specifier-seq* cannot appeartain to an
127
  explicit instantiation [[temp.explicit]]. — *end note*]
128
 
129
  For an *attribute-token* (including an *attribute-scoped-token*) not
130
+ specified in this document, the behavior is *implementation-defined*;
131
+ any such *attribute-token* that is not recognized by the implementation
132
+ is ignored.
133
+
134
+ [*Note 4*: A program is ill-formed if it contains an *attribute*
135
+ specified in [[dcl.attr]] that violates the rules specifying to which
136
+ entity or statement the attribute can apply or the syntax rules for the
137
+ attribute’s *attribute-argument-clause*, if any. — *end note*]
138
+
139
+ [*Note 5*: The *attribute*s specified in [[dcl.attr]] have optional
140
+ semantics: given a well-formed program, removing all instances of any
141
+ one of those *attribute*s results in a program whose set of possible
142
+ executions [[intro.abstract]] for a given input is a subset of those of
143
+ the original program for the same input, absent implementation-defined
144
+ guarantees with respect to that *attribute*. — *end note*]
145
+
146
+ An *attribute-token* is reserved for future standardization if
147
 
148
  - it is not an *attribute-scoped-token* and is not specified in this
149
  document, or
150
  - it is an *attribute-scoped-token* and its *attribute-namespace* is
151
  `std` followed by zero or more digits.
152
 
153
+ Each implementation should choose a distinctive name for the
154
+ *attribute-namespace* in an *attribute-scoped-token*.
155
 
156
  Two consecutive left square bracket tokens shall appear only when
157
  introducing an *attribute-specifier* or within the *balanced-token-seq*
158
  of an *attribute-argument-clause*.
159
 
160
+ [*Note 6*: If two consecutive left square brackets appear where an
161
  *attribute-specifier* is not allowed, the program is ill-formed even if
162
  the brackets match an alternative grammar production. — *end note*]
163
 
164
  [*Example 2*:
165
 
 
264
  extern unsigned char c[sizeof(double)]; // error: different alignment in declaration
265
  ```
266
 
267
  — *end example*]
268
 
269
+ ### Assumption attribute <a id="dcl.attr.assume">[[dcl.attr.assume]]</a>
270
+
271
+ The *attribute-token* `assume` may be applied to a null statement; such
272
+ a statement is an *assumption*. An *attribute-argument-clause* shall be
273
+ present and shall have the form:
274
+
275
+ ``` bnf
276
+ '(' conditional-expression ')'
277
+ ```
278
+
279
+ The expression is contextually converted to `bool` [[conv.general]]. The
280
+ expression is not evaluated. If the converted expression would evaluate
281
+ to `true` at the point where the assumption appears, the assumption has
282
+ no effect. Otherwise, the behavior is undefined.
283
+
284
+ [*Note 1*: The expression is potentially evaluated [[basic.def.odr]].
285
+ The use of assumptions is intended to allow implementations to analyze
286
+ the form of the expression and deduce information used to optimize the
287
+ program. Implementations are not required to deduce any information from
288
+ any particular assumption. — *end note*]
289
+
290
+ [*Example 1*:
291
+
292
+ ``` cpp
293
+ int divide_by_32(int x) {
294
+ [[assume(x >= 0)]];
295
+ return x/32; // The instructions produced for the division
296
+ // may omit handling of negative values.
297
+ }
298
+ int f(int y) {
299
+ [[assume(++y == 43)]]; // y is not incremented
300
+ return y; // statement may be replaced with return 42;
301
+ }
302
+ ```
303
+
304
+ — *end example*]
305
+
306
  ### Carries dependency attribute <a id="dcl.attr.depend">[[dcl.attr.depend]]</a>
307
 
308
  The *attribute-token* `carries_dependency` specifies dependency
309
+ propagation into and out of functions. No *attribute-argument-clause*
310
+ shall be present. The attribute may be applied to a parameter of a
311
+ function or lambda, in which case it specifies that the initialization
312
+ of the parameter carries a dependency to [[intro.multithread]] each
313
+ lvalue-to-rvalue conversion [[conv.lval]] of that object. The attribute
314
+ may also be applied to a function or a lambda call operator, in which
315
+ case it specifies that the return value, if any, carries a dependency to
316
+ the evaluation of the function call expression.
 
 
317
 
318
  The first declaration of a function shall specify the
319
  `carries_dependency` attribute for its *declarator-id* if any
320
  declaration of the function specifies the `carries_dependency`
321
  attribute. Furthermore, the first declaration of a function shall
 
327
  parameters is declared without the `carries_dependency` attribute in its
328
  first declaration in another translation unit, the program is
329
  ill-formed, no diagnostic required.
330
 
331
  [*Note 1*: The `carries_dependency` attribute does not change the
332
+ meaning of the program, but might result in generation of more efficient
333
  code. — *end note*]
334
 
335
  [*Example 1*:
336
 
337
  ``` cpp
 
383
  entities whose use is still allowed, but is discouraged for some reason.
384
 
385
  [*Note 1*: In particular, `deprecated` is appropriate for names and
386
  entities that are deemed obsolescent or unsafe. — *end note*]
387
 
388
+ An *attribute-argument-clause* may be present and, if present, it shall
 
389
  have the form:
390
 
391
  ``` bnf
392
  '(' string-literal ')'
393
  ```
394
 
395
+ [*Note 2*: The *string-literal* in the *attribute-argument-clause* can
396
+ be used to explain the rationale for deprecation and/or to suggest a
397
+ replacing entity. — *end note*]
398
 
399
  The attribute may be applied to the declaration of a class, a
400
  *typedef-name*, a variable, a non-static data member, a function, a
401
+ namespace, an enumeration, an enumerator, a concept, or a template
402
+ specialization.
403
 
404
+ An entity declared without the `deprecated` attribute can later be
405
+ redeclared with the attribute and vice-versa.
406
 
407
  [*Note 3*: Thus, an entity initially declared without the attribute can
408
  be marked as deprecated by a subsequent redeclaration. However, after an
409
  entity is marked as deprecated, later redeclarations do not un-deprecate
410
  the entity. — *end note*]
 
421
  attribute applied to the name or entity.
422
 
423
  ### Fallthrough attribute <a id="dcl.attr.fallthrough">[[dcl.attr.fallthrough]]</a>
424
 
425
  The *attribute-token* `fallthrough` may be applied to a null statement
426
+ [[stmt.expr]]; such a statement is a fallthrough statement. No
427
+ *attribute-argument-clause* shall be present. A fallthrough statement
428
+ may only appear within an enclosing `switch` statement [[stmt.switch]].
429
+ The next statement that would be executed after a fallthrough statement
430
+ shall be a labeled statement whose label is a case label or default
431
+ label for the same `switch` statement and, if the fallthrough statement
432
+ is contained in an iteration statement, the next statement shall be part
433
+ of the same execution of the substatement of the innermost enclosing
434
+ iteration statement. The program is ill-formed if there is no such
435
+ statement.
 
436
 
437
  *Recommended practice:* The use of a fallthrough statement should
438
  suppress a warning that an implementation might otherwise issue for a
439
  case or default label that is reachable from another case or default
440
  label along some path of execution. Implementations should issue a
 
474
  — *end example*]
475
 
476
  ### Likelihood attributes <a id="dcl.attr.likelihood">[[dcl.attr.likelihood]]</a>
477
 
478
  The *attribute-token*s `likely` and `unlikely` may be applied to labels
479
+ or statements. No *attribute-argument-clause* shall be present. The
480
+ *attribute-token* `likely` shall not appear in an
481
+ *attribute-specifier-seq* that contains the *attribute-token*
482
+ `unlikely`.
 
483
 
484
  *Recommended practice:* The use of the `likely` attribute is intended to
485
  allow implementations to optimize for the case where paths of execution
486
  including it are arbitrarily more likely than any alternative path of
487
  execution that does not include such an attribute on a statement or
 
521
  — *end example*]
522
 
523
  ### Maybe unused attribute <a id="dcl.attr.unused">[[dcl.attr.unused]]</a>
524
 
525
  The *attribute-token* `maybe_unused` indicates that a name or entity is
526
+ possibly intentionally unused. No *attribute-argument-clause* shall be
527
+ present.
528
 
529
  The attribute may be applied to the declaration of a class, a
530
  *typedef-name*, a variable (including a structured binding declaration),
531
  a non-static data member, a function, an enumeration, or an enumerator.
532
 
 
556
 
557
  — *end example*]
558
 
559
  ### Nodiscard attribute <a id="dcl.attr.nodiscard">[[dcl.attr.nodiscard]]</a>
560
 
561
+ The *attribute-token* `nodiscard` may be applied to a function or a
562
+ lambda call operator or to the declaration of a class or enumeration. An
 
563
  *attribute-argument-clause* may be present and, if present, shall have
564
  the form:
565
 
566
  ``` bnf
567
  '(' string-literal ')'
 
584
  is either
585
 
586
  - a function call expression [[expr.call]] that calls a function
587
  declared `nodiscard` in a reachable declaration or whose return type
588
  is a nodiscard type, or
589
+ - an explicit type conversion
590
+ [[expr.type.conv]], [[expr.static.cast]], [[expr.cast]] that
591
+ constructs an object through a constructor declared `nodiscard` in a
592
+ reachable declaration, or that initializes an object of a nodiscard
593
+ type.
594
 
595
  *Recommended practice:* Appearance of a nodiscard call as a
596
  potentially-evaluated discarded-value expression [[expr.prop]] is
597
  discouraged unless explicitly cast to `void`. Implementations should
598
  issue a warning in such cases.
 
634
  — *end example*]
635
 
636
  ### Noreturn attribute <a id="dcl.attr.noreturn">[[dcl.attr.noreturn]]</a>
637
 
638
  The *attribute-token* `noreturn` specifies that a function does not
639
+ return. No *attribute-argument-clause* shall be present. The attribute
640
+ may be applied to a function or a lambda call operator. The first
 
641
  declaration of a function shall specify the `noreturn` attribute if any
642
  declaration of that function specifies the `noreturn` attribute. If a
643
  function is declared with the `noreturn` attribute in one translation
644
  unit and the same function is declared without the `noreturn` attribute
645
  in another translation unit, the program is ill-formed, no diagnostic
 
671
  — *end example*]
672
 
673
  ### No unique address attribute <a id="dcl.attr.nouniqueaddr">[[dcl.attr.nouniqueaddr]]</a>
674
 
675
  The *attribute-token* `no_unique_address` specifies that a non-static
676
+ data member is a potentially-overlapping subobject [[intro.object]]. No
 
677
  *attribute-argument-clause* shall be present. The attribute may
678
  appertain to a non-static data member other than a bit-field.
679
 
680
  [*Note 1*: The non-static data member can share the address of another
681
  non-static data member or that of a base class, and any padding that
 
711
  [basic.fundamental]: basic.md#basic.fundamental
712
  [basic.life]: basic.md#basic.life
713
  [basic.link]: basic.md#basic.link
714
  [basic.lookup]: basic.md#basic.lookup
715
  [basic.lookup.argdep]: basic.md#basic.lookup.argdep
 
716
  [basic.lookup.elab]: basic.md#basic.lookup.elab
717
+ [basic.lookup.general]: basic.md#basic.lookup.general
718
  [basic.lookup.qual]: basic.md#basic.lookup.qual
719
  [basic.lookup.udir]: basic.md#basic.lookup.udir
720
  [basic.lookup.unqual]: basic.md#basic.lookup.unqual
721
  [basic.namespace]: #basic.namespace
722
+ [basic.namespace.general]: #basic.namespace.general
 
 
723
  [basic.scope.namespace]: basic.md#basic.scope.namespace
724
+ [basic.scope.scope]: basic.md#basic.scope.scope
 
725
  [basic.start]: basic.md#basic.start
726
  [basic.start.dynamic]: basic.md#basic.start.dynamic
727
  [basic.start.static]: basic.md#basic.start.static
728
  [basic.stc]: basic.md#basic.stc
729
  [basic.stc.auto]: basic.md#basic.stc.auto
 
731
  [basic.stc.dynamic.allocation]: basic.md#basic.stc.dynamic.allocation
732
  [basic.stc.dynamic.deallocation]: basic.md#basic.stc.dynamic.deallocation
733
  [basic.stc.static]: basic.md#basic.stc.static
734
  [basic.stc.thread]: basic.md#basic.stc.thread
735
  [basic.type.qualifier]: basic.md#basic.type.qualifier
 
736
  [class]: class.md#class
737
  [class.access]: class.md#class.access
738
+ [class.access.base]: class.md#class.access.base
739
  [class.base.init]: class.md#class.base.init
740
  [class.bit]: class.md#class.bit
 
 
741
  [class.conv.ctor]: class.md#class.conv.ctor
742
  [class.conv.fct]: class.md#class.conv.fct
743
  [class.copy.assign]: class.md#class.copy.assign
744
  [class.copy.ctor]: class.md#class.copy.ctor
745
  [class.copy.elision]: class.md#class.copy.elision
 
749
  [class.expl.init]: class.md#class.expl.init
750
  [class.friend]: class.md#class.friend
751
  [class.inhctor.init]: class.md#class.inhctor.init
752
  [class.init]: class.md#class.init
753
  [class.mem]: class.md#class.mem
754
+ [class.mem.general]: class.md#class.mem.general
755
+ [class.member.lookup]: basic.md#class.member.lookup
756
  [class.mfct]: class.md#class.mfct
757
  [class.mi]: class.md#class.mi
758
  [class.name]: class.md#class.name
759
  [class.pre]: class.md#class.pre
760
  [class.qual]: basic.md#class.qual
 
765
  [class.union.anon]: class.md#class.union.anon
766
  [class.virtual]: class.md#class.virtual
767
  [conv]: expr.md#conv
768
  [conv.array]: expr.md#conv.array
769
  [conv.func]: expr.md#conv.func
770
+ [conv.general]: expr.md#conv.general
771
+ [conv.integral]: expr.md#conv.integral
772
  [conv.lval]: expr.md#conv.lval
773
  [conv.prom]: expr.md#conv.prom
774
  [conv.ptr]: expr.md#conv.ptr
775
  [conv.qual]: expr.md#conv.qual
776
  [conv.rval]: expr.md#conv.rval
 
779
  [dcl.align]: #dcl.align
780
  [dcl.ambig.res]: #dcl.ambig.res
781
  [dcl.array]: #dcl.array
782
  [dcl.asm]: #dcl.asm
783
  [dcl.attr]: #dcl.attr
784
+ [dcl.attr.assume]: #dcl.attr.assume
785
  [dcl.attr.depend]: #dcl.attr.depend
786
  [dcl.attr.deprecated]: #dcl.attr.deprecated
787
  [dcl.attr.fallthrough]: #dcl.attr.fallthrough
788
  [dcl.attr.grammar]: #dcl.attr.grammar
789
  [dcl.attr.likelihood]: #dcl.attr.likelihood
 
793
  [dcl.attr.unused]: #dcl.attr.unused
794
  [dcl.constexpr]: #dcl.constexpr
795
  [dcl.constinit]: #dcl.constinit
796
  [dcl.dcl]: #dcl.dcl
797
  [dcl.decl]: #dcl.decl
798
+ [dcl.decl.general]: #dcl.decl.general
799
  [dcl.enum]: #dcl.enum
800
  [dcl.fct]: #dcl.fct
801
  [dcl.fct.def]: #dcl.fct.def
802
  [dcl.fct.def.coroutine]: #dcl.fct.def.coroutine
803
  [dcl.fct.def.default]: #dcl.fct.def.default
 
806
  [dcl.fct.default]: #dcl.fct.default
807
  [dcl.fct.spec]: #dcl.fct.spec
808
  [dcl.friend]: #dcl.friend
809
  [dcl.init]: #dcl.init
810
  [dcl.init.aggr]: #dcl.init.aggr
811
+ [dcl.init.general]: #dcl.init.general
812
  [dcl.init.list]: #dcl.init.list
813
  [dcl.init.ref]: #dcl.init.ref
814
  [dcl.init.string]: #dcl.init.string
815
  [dcl.inline]: #dcl.inline
816
  [dcl.link]: #dcl.link
817
  [dcl.meaning]: #dcl.meaning
818
+ [dcl.meaning.general]: #dcl.meaning.general
819
  [dcl.mptr]: #dcl.mptr
820
  [dcl.name]: #dcl.name
821
  [dcl.pre]: #dcl.pre
822
  [dcl.ptr]: #dcl.ptr
823
  [dcl.ref]: #dcl.ref
824
  [dcl.spec]: #dcl.spec
825
  [dcl.spec.auto]: #dcl.spec.auto
826
+ [dcl.spec.auto.general]: #dcl.spec.auto.general
827
+ [dcl.spec.general]: #dcl.spec.general
828
  [dcl.stc]: #dcl.stc
829
  [dcl.struct.bind]: #dcl.struct.bind
830
  [dcl.type]: #dcl.type
831
  [dcl.type.auto.deduct]: #dcl.type.auto.deduct
832
  [dcl.type.class.deduct]: #dcl.type.class.deduct
833
  [dcl.type.cv]: #dcl.type.cv
834
  [dcl.type.decltype]: #dcl.type.decltype
835
  [dcl.type.elab]: #dcl.type.elab
836
+ [dcl.type.general]: #dcl.type.general
837
  [dcl.type.simple]: #dcl.type.simple
838
  [dcl.typedef]: #dcl.typedef
839
  [depr.volatile.type]: future.md#depr.volatile.type
840
  [enum]: #enum
841
  [enum.udecl]: #enum.udecl
842
  [except.ctor]: except.md#except.ctor
843
  [except.handle]: except.md#except.handle
844
+ [except.pre]: except.md#except.pre
845
  [except.spec]: except.md#except.spec
846
  [except.throw]: except.md#except.throw
847
  [expr.alignof]: expr.md#expr.alignof
848
  [expr.ass]: expr.md#expr.ass
849
  [expr.await]: expr.md#expr.await
850
  [expr.call]: expr.md#expr.call
851
  [expr.cast]: expr.md#expr.cast
852
+ [expr.comma]: expr.md#expr.comma
853
  [expr.const]: expr.md#expr.const
854
  [expr.const.cast]: expr.md#expr.const.cast
855
  [expr.mptr.oper]: expr.md#expr.mptr.oper
856
  [expr.new]: expr.md#expr.new
857
  [expr.post.incr]: expr.md#expr.post.incr
858
  [expr.pre.incr]: expr.md#expr.pre.incr
859
+ [expr.prim.id.unqual]: expr.md#expr.prim.id.unqual
860
  [expr.prim.lambda]: expr.md#expr.prim.lambda
861
  [expr.prim.this]: expr.md#expr.prim.this
862
  [expr.prop]: expr.md#expr.prop
863
  [expr.ref]: expr.md#expr.ref
864
  [expr.static.cast]: expr.md#expr.static.cast
865
  [expr.sub]: expr.md#expr.sub
866
  [expr.type.conv]: expr.md#expr.type.conv
867
  [expr.unary]: expr.md#expr.unary
868
  [expr.unary.op]: expr.md#expr.unary.op
869
  [expr.yield]: expr.md#expr.yield
870
+ [initializer.list.syn]: support.md#initializer.list.syn
871
+ [intro.abstract]: intro.md#intro.abstract
872
  [intro.compliance]: intro.md#intro.compliance
873
  [intro.execution]: basic.md#intro.execution
874
  [intro.multithread]: basic.md#intro.multithread
875
  [intro.object]: basic.md#intro.object
 
876
  [lex.digraph]: lex.md#lex.digraph
877
  [lex.key]: lex.md#lex.key
878
  [lex.name]: lex.md#lex.name
879
  [lex.string]: lex.md#lex.string
880
  [module.interface]: module.md#module.interface
881
+ [module.reach]: module.md#module.reach
882
+ [module.unit]: module.md#module.unit
883
  [namespace.alias]: #namespace.alias
884
  [namespace.def]: #namespace.def
885
+ [namespace.def.general]: #namespace.def.general
886
  [namespace.qual]: basic.md#namespace.qual
887
  [namespace.udecl]: #namespace.udecl
888
  [namespace.udir]: #namespace.udir
889
  [namespace.unnamed]: #namespace.unnamed
890
  [over]: over.md#over
891
  [over.binary]: over.md#over.binary
892
+ [over.literal]: over.md#over.literal
893
  [over.match]: over.md#over.match
894
  [over.match.best]: over.md#over.match.best
895
  [over.match.class.deduct]: over.md#over.match.class.deduct
896
  [over.match.conv]: over.md#over.match.conv
897
  [over.match.copy]: over.md#over.match.copy
 
901
  [over.match.ref]: over.md#over.match.ref
902
  [over.match.viable]: over.md#over.match.viable
903
  [over.oper]: over.md#over.oper
904
  [over.sub]: over.md#over.sub
905
  [special]: class.md#special
906
+ [std.modules]: library.md#std.modules
907
  [stmt.ambig]: stmt.md#stmt.ambig
908
  [stmt.dcl]: stmt.md#stmt.dcl
909
  [stmt.expr]: stmt.md#stmt.expr
910
  [stmt.if]: stmt.md#stmt.if
911
  [stmt.iter]: stmt.md#stmt.iter
 
 
912
  [stmt.return]: stmt.md#stmt.return
913
  [stmt.return.coroutine]: stmt.md#stmt.return.coroutine
914
  [stmt.select]: stmt.md#stmt.select
915
  [stmt.stmt]: stmt.md#stmt.stmt
916
  [stmt.switch]: stmt.md#stmt.switch
917
  [support.runtime]: support.md#support.runtime
918
  [temp.arg.type]: temp.md#temp.arg.type
919
+ [temp.decls]: temp.md#temp.decls
920
  [temp.deduct]: temp.md#temp.deduct
921
  [temp.deduct.call]: temp.md#temp.deduct.call
922
+ [temp.deduct.decl]: temp.md#temp.deduct.decl
923
  [temp.deduct.guide]: temp.md#temp.deduct.guide
924
+ [temp.dep.type]: temp.md#temp.dep.type
925
  [temp.expl.spec]: temp.md#temp.expl.spec
926
  [temp.explicit]: temp.md#temp.explicit
927
  [temp.fct]: temp.md#temp.fct
928
  [temp.inst]: temp.md#temp.inst
929
  [temp.local]: temp.md#temp.local
 
930
  [temp.names]: temp.md#temp.names
 
931
  [temp.param]: temp.md#temp.param
932
  [temp.pre]: temp.md#temp.pre
933
  [temp.res]: temp.md#temp.res
934
+ [temp.spec.partial]: temp.md#temp.spec.partial
935
  [temp.variadic]: temp.md#temp.variadic
936
+ [term.odr.use]: basic.md#term.odr.use
937
+ [term.padding.bits]: basic.md#term.padding.bits
938
+ [term.scalar.type]: basic.md#term.scalar.type
939
+ [term.unevaluated.operand]: expr.md#term.unevaluated.operand
940
 
941
  [^1]: There is no special provision for a *decl-specifier-seq* that
942
  lacks a *type-specifier* or that has a *type-specifier* that only
943
  specifies *cv-qualifier*s. The “implicit int” rule of C is no longer
944
  supported.
 
966
  reference type.
967
 
968
  [^8]: Implementations are permitted to provide additional predefined
969
  variables with names that are reserved to the implementation
970
  [[lex.name]]. If a predefined variable is not odr-used
971
+ [[term.odr.use]], its string value need not be present in the
972
  program image.
973
 
974
  [^9]: This set of values is used to define promotion and conversion
975
  semantics for the enumeration type. It does not preclude an
976
  expression of enumeration type from having a value that falls
977
  outside this range.
978
 
979
+ [^10]: During name lookup in a class hierarchy, some ambiguities can be
 
 
 
980
  resolved by considering whether one member hides the other along
981
+ some paths [[class.member.lookup]]. There is no such
982
+ disambiguation when considering the set of names found as a result
983
+ of following \*using-directive\*s.
984
 
985
+ [^11]: A *using-declaration* with more than one *using-declarator* is
986
  equivalent to a corresponding sequence of *using-declaration*s with
987
  one *using-declarator* each.