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

P0388R4 Permit conversions to arrays of unknown bound #3090

Merged
merged 4 commits into from Aug 2, 2019

Conversation

jensmaurer
Copy link
Member

Fixes #2995.

@burblebee burblebee self-assigned this Aug 1, 2019
source/expressions.tex Show resolved Hide resolved
source/expressions.tex Outdated Show resolved Hide resolved
source/overloading.tex Show resolved Hide resolved
source/expressions.tex Show resolved Hide resolved
source/overloading.tex Show resolved Hide resolved
@zygoloid zygoloid merged commit 216c993 into master Aug 2, 2019
@jensmaurer jensmaurer deleted the motions-2019-07-cwg-15 branch December 15, 2019 19:51
@willwray
Copy link

willwray commented Feb 12, 2020

(Not sure if this is the place for questions / clarifications. Trying anyway.)

Should the conversion from T[N] to T(&)[] be permitted for deduced type T?

C.f. GCC bug 93191
GCC has implemented P0388, so this works:

    void cat(char const(&cstr)[]) { puts(cstr); }
    cat("Hello");    // prints "Hello"

but, on changing char to auto, it is rejected:

    void cat(auto const(&cstr)[]) { puts(cstr); }
    cat("Hello");  // error: no matching function

(same with explicit template syntax template <typename C> void cat(C const(&cstr)[]);)
Ideally cat would be variadic

    void cat(auto const(&...cstr)[]) { (puts(cstr),...); }

but deduction is required for the variadic signature.

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.

[2019-07 CWG Motion 15] P0388R4 Permit conversions to arrays of unknown bound
4 participants