cplusplus / CWG

Core Working Group
23 stars 7 forks source link

[class.pre] p5 which `final` does the wording refer #540

Closed xmh0511 closed 1 month ago

xmh0511 commented 1 month ago

Full name of submitter (unless configured in github; will be published with the issue): Jim X

[class.pre] p5:

Whenever a class-key is followed by a class-head-name, the identifier final, and a colon or left brace, final is interpreted as a class-virt-specifier.

Consider this example:

struct final final{};

final in the wording final is interpreted as a class-virt-specifier is unclear.

Suggested resolution

the final that is not a class-head-name is interpreted as a class-virt-specifier

jensmaurer commented 1 month ago

Since the wording talks about the "final" after the class-head-name, it's clear enough that a "final" inside the class-head-name is not intended.