-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add mangling for a call expression with semantically significant parentheses #196
base: main
Are you sure you want to change the base?
Add mangling for a call expression with semantically significant parentheses #196
Conversation
Clarify that `cp` is to be used only when ADL would occur without the parentheses.
Notes re: CWG 2946:
|
@@ -5675,6 +5675,7 @@ <h4><a href="#expressions">5.1.6 Expressions</a></h4> | |||
::= pp_ <<a href="#mangle.expression">expression</a>> # prefix ++ | |||
::= mm_ <<a href="#mangle.expression">expression</a>> # prefix -- | |||
::= cl <<a href="#mangle.expression">expression</a>>+ E # expression (expr-list), call | |||
::= cp <<a href="#mangle.base-unresolved-name">base-unresolved-name</a>> <<a href="#mangle.expression">expression</a>>* E # (name) (expr-list), call that would use argument-dependent lookup but for the parentheses |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this merits a paragraph below explaining the rule exactly. Maybe something like this:
In C++, a call expression where the callee operand is an unqualified name uses argument-dependent lookup unless unqualified lookup finds certain kinds of declarations; see [class.lookup.argdep]p3. Because this rule does not apply when the name is parenthesized, it is sometimes necessary to distinguish parenthesized and unparenthesized calls in the mangling, despite the general rule that parentheses can be ignored. This is encoded using the choice of
cl
orcp
for the call expression. Thecp
mangling is used only when the callee operand is a parenthesized unresolved name and would have used ADL if it were not parenthesized. In particular,cl
is still used when unqualified lookup finds a declaration that would suppress the use of ADL, such as a class member.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added the paragraph. I indicated that the reference is to C++11 because the paragraph number for the rule was different before and has since changed. The wording around the block scope case was not present in C++03.
Co-authored-by: John McCall <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, LGTM. I'll leave this up for a week for further comments.
See
#188 (comment)