Skip to content

[BUG] Unable to call a member function on a heap object. #673

Closed
@guybrush77

Description

@guybrush77

Describe the bug

Unable to call a member function on a heap object.

To Reproduce

I am presuming the following should work seamlessly:

// test.cpp2
foo : type = {
    print: (this) = std::cout << "Hello!\n";
}

main: () = {
    f := new<foo>;
    f*.print();
}

Transpiling works:

cppfront -version
cppfront compiler v0.2.1   Build 8910:1255

cppfront -p test.cpp2 
test.cpp2... ok (all Cpp2, passes safety checks)

Compiling fails:

clang++-15 -std=c++20 test.cpp
test.cpp2:8:17: error: use of undeclared identifier 'print'
CPP2_UFCS_0(print, (*cpp2::assert_not_null(std::move(f))));

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions