Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

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

Closed

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))));

Activity

  1. added
    bug
    on Sep 11, 2023
  2. changed the title [-][BUG] [/-] [+][BUG] Unable to call a member function on a heap object.[/+] on Sep 11, 2023
  3. guybrush77 commented on Sep 11, 2023

    @guybrush77
    Author

    @JohelEGP Thanks, that makes sense. I will close this bug.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions