This example on cppx.godbolt introduces an interface that injects code into a class. If I try to use the interface twice, e.g. by defining a second class Foo after Shape like this:
I get a compilation error:
error: redefinition of 'interface' as different kind of symbol
https://cppx.godbolt.org/z/MMx1jxoqf
At first sight this looks like a parsing issue to me (class interface instead of class(interface)), but then I wonder why it works for the first use....
Use Case: I tried to implement an interface equality_comparable that injects a bool operator==()(X const& other) method into a class, similar to the #[derive(PartialEq)] attribute in rust or the defaulted comparison operators (as of C++20).
Injecting the code into the classes directly works: https://cppx.godbolt.org/z/W5hzojM6o, injecting via interface fails with the above error: https://cppx.godbolt.org/z/nor384hWb
PS: This is an awesome powerful proposal. I would love to see it happen!