Skip to content

Conversation

jensmaurer
Copy link
Member

Fixes #2995.

@burblebee burblebee self-assigned this Aug 1, 2019
@zygoloid zygoloid force-pushed the motions-2019-07-cwg-15 branch from 2eaecd7 to 1168f25 Compare August 2, 2019 22:37
@zygoloid zygoloid force-pushed the motions-2019-07-cwg-15 branch from 1168f25 to c0c5898 Compare August 2, 2019 23:00
@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