Skip to content

In parameter move from last use #18

Description

@hsutter

The last line prints 1, but it should print 2 because f(param) is the definite last use of the param... Godbolt repro: https://cppx.godbolt.org/z/17noYP

struct X {}; 
void f(X const&) { cout << "1\n"; } 
void f(X &&    ) { cout << "2\n"; } 

void test(in X param) { f(param); }

int main() { 
    X x; 
    test(x);       // 1 

    test(X());     // *** should be 2
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions