Skip to content
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

Use unqualified function calls for valarray #286

Merged
merged 2 commits into from
Nov 12, 2019

Conversation

miscco
Copy link
Contributor

@miscco miscco commented Nov 10, 2019

Description

The standard requires that the transcend functions that are applied unqualified to each element of valarray.

This addresses #285

Checklist

Be sure you've read README.md and understand the scope of this repo.

If you're unsure about a box, leave it unchecked. A maintainer will help you.

  • Identifiers in product code changes are properly _Ugly as per
    https://eel.is/c++draft/lex.name#3.1 or there are no product code changes.
  • The STL builds successfully and all tests have passed (must be manually
    verified by an STL maintainer before automated testing is enabled on GitHub,
    leave this unchecked for initial submission).
  • These changes introduce no known ABI breaks (adding members, renaming
    members, adding virtual functions, changing whether a type is an aggregate
    or trivially copyable, etc.).
  • These changes were written from scratch using only this repository and
    the C++ Working Draft as a reference (and any other cited standards).
    If they were derived from a project that's already listed in NOTICE.txt,
    that's fine, but please mention it. If they were derived from any other
    project (including Boost and libc++, which are not yet listed in
    NOTICE.txt), you must mention it here, so we can determine whether the
    license is compatible and what else needs to be done.

@miscco miscco requested a review from a team as a code owner November 10, 2019 20:26
Copy link
Member

@CaseyCarter CaseyCarter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[valarray,transcend]/1 is not the clearest paragraph of wording in the Standard. This paragraph came up while discussing Revision 2 of WG21-P1719 which changes the Requires to Mandates in LWG last week. We determined (1) this wording unclear, (2) we're not extremely motivated to cleanup valarray wording, and (3) we can't devise a sensible reading for this wording other than that it intends unqualified invocations which result in ADL.

TLDR: I agree with the intent of the P/R and agree it addresses the issue.

stl/inc/valarray Outdated Show resolved Hide resolved
stl/inc/valarray Outdated Show resolved Hide resolved
@miscco miscco force-pushed the valarray branch 2 times, most recently from e58c5a6 to 03236bf Compare November 11, 2019 05:24
The transcend functions require that the function is applied unqualified to each element
Copy link
Member

@CaseyCarter CaseyCarter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good modulo test coverage; we should have a test to validate the library finds functions via ADL.

Other maintainers: Should we comment these callsites to make it clear these unqualified calls are intentional?

@CaseyCarter
Copy link
Member

CaseyCarter commented Nov 11, 2019

/azp run

EDIT: Woops - I forgot the checks are now automatic and I don't need to poke the bot.

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@microsoft microsoft deleted a comment from azure-pipelines bot Nov 11, 2019
@StephanTLavavej
Copy link
Member

Other maintainers: Should we comment these callsites to make it clear these unqualified calls are intentional?

This is sufficiently unusual that I think comments are warranted, yes.

Copy link
Member

@StephanTLavavej StephanTLavavej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I went ahead and added comments, following the precedent of

*this = make_error_code(_Errcode); // using ADL

I don't think test coverage for this is necessary; we'd have to write "fancy numeric types". The comments should be sufficient to ensure that we don't add qualification during maintenance.

@StephanTLavavej
Copy link
Member

I'm porting this to MSVC-internal git now, thanks.

@StephanTLavavej StephanTLavavej merged commit 10f1c81 into microsoft:master Nov 12, 2019
@StephanTLavavej
Copy link
Member

Thanks again for the bugfix! :-)

@miscco miscco deleted the valarray branch January 18, 2020 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants