Skip to content

Commit c369f1f

Browse files
ntreldlang-bot
authored andcommitted
[spec/attribute] 3 Tweaks
Fix TOC for C++ namespaces. Improve `@disable` example. Don't group `ref` and `return` under function attributes, because they also apply to parameters.
1 parent bcff902 commit c369f1f

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

spec/attribute.dd

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ extern (Windows):
188188
$(P Note that a $(DDSUBLINK spec/declaration, extern, lone $(D extern) keyword)
189189
is used as a storage class.)
190190

191-
$(H3 C++ $(LNAME2 namespace, Namespaces))
191+
$(H3 $(LNAME2 namespace, C++ Namespaces))
192192

193193
$(P The linkage form $(D extern $(LPAREN)C++, )$(I QualifiedIdentifier)$(D $(RPAREN))
194194
creates C++ declarations that reside in C++ namespaces. The $(I QualifiedIdentifier)
@@ -659,10 +659,14 @@ operations or overloads at compile time rather than relying on generating a
659659
runtime error.)
660660

661661
---
662-
@disable void foo() { }
663-
---
664-
---
665-
void main() { foo(); /* error, foo is disabled */ }
662+
@disable int x;
663+
@disable void foo();
664+
665+
void main()
666+
{
667+
x++; // error, x is disabled
668+
foo(); // error, foo is disabled
669+
}
666670
---
667671

668672
$(P $(DDSUBLINK spec/struct, disable_default_construction, `@disable this();`)
@@ -720,11 +724,11 @@ $(H3 $(LNAME2 pure, $(D pure) Attribute))
720724

721725
$(P See $(DDSUBLINK spec/function, pure-functions, Pure Functions).)
722726

723-
$(H3 $(LNAME2 ref, $(D ref) Attribute))
727+
$(H2 $(LNAME2 ref, $(D ref) Attribute))
724728

725729
$(P See $(DDSUBLINK spec/declaration, ref-storage, `ref` Storage Class).)
726730

727-
$(H3 $(LNAME2 return, $(D return) Attribute))
731+
$(H2 $(LNAME2 return, $(D return) Attribute))
728732

729733
* $(DDSUBLINK spec/function, return-ref-parameters, Return Ref Parameters).
730734
* $(DDSUBLINK spec/function, return-scope-parameters, Return Scope Parameters).

0 commit comments

Comments
 (0)