You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
If, within a class hierarchy, a derived type has an operator=: (out this, that), then the lowered cpp1 code will attempt to initialise the base class using that.Base as if Base were a member.
To Reproduce
Steps to reproduce the behavior:
Sample code - distilled down to minimal essentials please
The following cpp2 code:
Base : type = {
operator=: (out this, that) = {}
}
Derived : type = {
this: Base = ();
operator=: (out this, that) = {}
}
will produce the following function definition for the copy constructor of Derived in cpp1:
5. Expected result - what you expected to happen
I would expect the copy constructor to be emitted as
Derived::Derived(Derived const& that)
: Base{ that }
{}
and that the emitted code would compile
I think the access should be explicit
to prevent a templated constructor from being chosen over the copy constructor,
i.e., : Base{ static_cast<Base const&>(that) } rather than : Base{ that }.
And fix a bug this exposed - generated `operator=` memberwise emitted wrong syntax for a base type... previous test cases did not have copyable base types, but `cpp2::meta` embraces copyable base types as a design choice which is find because they aren't polymorphic in the usual inheritance sense
Describe the bug
If, within a class hierarchy, a derived type has an
operator=: (out this, that)
, then the lowered cpp1 code will attempt to initialise the base class usingthat.Base
as ifBase
were a member.To Reproduce
Steps to reproduce the behavior:
The following cpp2 code:
will produce the following function definition for the copy constructor of
Derived
in cpp1:This will not compile.
2. Command lines including which C++ compiler you are using
cppfront is compiled with gcc12 and executed using
The emitted cpp1 is also being compiled with gcc12.
I would expect the copy constructor to be emitted as
and that the emitted code would compile
The emitted code refers to the base class as
that.Base
and does not compile with the following error on gcc:The text was updated successfully, but these errors were encountered: