-
Notifications
You must be signed in to change notification settings - Fork 266
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
public this:
is disallowed. But before a this
data member, a public
non-this
data member is not diagnosed, and has no effect.
Minimal reproducer:
x: type = { }
y: type = { }
z: type = {
public a: x = x();
this: y = ();
operator=: (out this) = { }
}
w: x = z().a;
Commands:
cppfront x.cpp2
clang++17 -std=c++2b -stdlib=libc++ -I $CPPFRONT_INCLUDE_DIR x.cpp
Expected result: A well-formed program, or a diagnostic.
Actual result and error:
Generated C++1
//=== Cpp2 type declarations ====================================================
#include "cpp2util.h"
#line 1 "x.cpp2"
class x;
class y;
class z;
//=== Cpp2 type definitions and function declarations ===========================
#line 1 "x.cpp2"
class x {};
class y {};
class z: private cpp2::store_as_base<"a",x>, public y {
#line 6 "x.cpp2"
public: z();
};
extern x w;
//=== Cpp2 function definitions =================================================
#line 6 "x.cpp2"
z::z()
: cpp2::store_as_base<"a",x>{ x() }
#line 6 "x.cpp2"
{}
x w {z().a};
x.cpp2:8:10: error: no member named 'a' in 'z'
x w {z().a};
~~~ ^
1 error generated.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working