Movatterモバイル変換


[0]ホーム

URL:


Issue 2390 - WG21 CWG Issues
Title
Is the argument of __has_cpp_attribute macro-expanded?
Status
cd5
Section
15.2 [cpp.cond]
Submitter
Richard Smith

Created on2018-11-14.00:00:00 last changed62 months ago

Messages

msg6429 (view)
Date: 2019-06-15.00:00:00

Proposed resolution (June, 2019):

  1. Change 15.2 [cpp.cond] paragraph 5 as follows:

  2. Eachhas-attribute-expression is replaced by anon-zeropp-number matching the form ofaninteger-literal if the implementation supports anattribute with the name specified by interpretingthepp-tokens, after macro expansion,as anattribute-token, and by0otherwise. The program is ill-formed if thepp-tokensdo not match the form of anattribute-token.
  3. Change 15.2 [cpp.cond] paragraph 11 as follows:

  4. After all replacements due to macro expansion andevaluations ofdefined-macro-expressions,andhas-include-expressions,andhas_attribute_expressions have beenperformed, all remaining identifiers and keywords, exceptfortrue andfalse, are replaced withthepp-number0, and then each preprocessingtoken is converted into a token. [Note: Analternative token (5.9 [lex.digraph]) is not anidentifier, even when its spelling consists entirely ofletters and underscores. Therefore it is not subject tothis replacement. —end note]
msg6428 (view)
Date: 2019-02-15.00:00:00

Notes from the February, 2019 meeting:

CWG observed that a use of an attribute would be macro-expanded,so it seemed reasonable to expect to be able to specify the samemacro as the argument to__has_cpp_attribute and get thecorresponding result.

msg6427 (view)
Date: 2019-07-15.00:00:00

[Accepted as a DR at the July, 2019 meeting.]

The Standard does not specify whether the argument of__has_cpp_attribute is macro-expanded before being testedto see if it names an attribute or not, and there is implementationdivergence.

History
DateUserActionArgs
2020-12-15 00:00:00adminsetmessages: +msg6429
2020-12-15 00:00:00adminsetmessages: +msg6428
2018-11-14 00:00:00admincreate

[8]ページ先頭

©2009-2026 Movatter.jp