On 3/6/18 5:27 PM, Timon Gehr wrote:
The reasoning "the reference is stored in the type yet not part of the
type" does not work for pure functions, as then you cannot offer an
alternative explanation in terms of an external data store.
Yeah, the more I think about it, the more I think the cont
On 06.03.2018 17:19, Steven Schveighoffer wrote:
unittest {
int n = 0;
struct S {
int fun() const { return n; }
}
immutable S s;
assert(s.fun == 0);
n++;
assert(s.fun == 1); // Not so immutable now, are you?
}
That's not a demonstration of breaking i
On 3/6/18 10:00 AM, Simen Kjærås wrote:
On Tuesday, 6 March 2018 at 13:56:30 UTC, Steven Schveighoffer wrote:
On 3/6/18 8:42 AM, Simen Kjærås wrote:
unittest {
int i = 0;
struct S {
int n;
void fun() const {
i++;
}
}
const S s;
as
On 3/6/18 9:42 AM, Shachar Shemesh wrote:
I fail to see any reasoning[1] that disallows the former but allows the
later.
1 - That is obviously not true. I see the reasoning all too well. Static
vars are like globals, and you're not getting to them via the struct's
instance. I would argue th
On 06/03/18 17:00, Simen Kjærås wrote:
Interestingly, replacing 'const' with 'immutable' on fun gives a
compilation error: "immutable function 'foo.__unittest_foo_1_0.S.fun'
cannot access mutable data 'n'".
This just means it is completely and totally broken. Changing the
"const" to "immutabl
On Tuesday, 6 March 2018 at 13:56:30 UTC, Steven Schveighoffer
wrote:
On 3/6/18 8:42 AM, Simen Kjærås wrote:
unittest {
int i = 0;
struct S {
int n;
void fun() const {
i++;
}
}
const S s;
assert(i == 0);
s.fun();
assert(i
Filed issue 18563
Shachar
On 06/03/18 16:06, Steven Schveighoffer wrote:
On 3/6/18 8:56 AM, Steven Schveighoffer wrote:
So a bug report is in order. It should be decided one way or another
-- either the context pointer is part of the struct type or it isn't.
There is a third possibility:
It's part of the type AND it's
On 3/6/18 8:56 AM, Steven Schveighoffer wrote:
On 3/6/18 8:42 AM, Simen Kjærås wrote:
It's a bug. As pointed out elsewhere in this thread, it compiles
correctly when there's no destructor. Essentially, this bug is caused
by the context pointer being typed as void*, and becoming (of course)
co
On 3/6/18 8:42 AM, Simen Kjærås wrote:
It's a bug. As pointed out elsewhere in this thread, it compiles
correctly when there's no destructor. Essentially, this bug is caused by
the context pointer being typed as void*, and becoming (of course)
const(void*) for a const(S). If it'd been const(vo
On Tuesday, 6 March 2018 at 12:00:43 UTC, Steven Schveighoffer
wrote:
On 3/6/18 6:21 AM, Simen Kjærås wrote:
On Tuesday, 6 March 2018 at 10:03:54 UTC, Shachar Shemesh
wrote:
void main() {
struct S {
uint value;
~this() {
}
}
const S a = S(12);
S b = a;
On 3/6/18 7:44 AM, Shachar Shemesh wrote:
On 06/03/18 14:00, Steven Schveighoffer wrote:
On 3/6/18 6:21 AM, Simen Kjærås wrote:
On Tuesday, 6 March 2018 at 10:03:54 UTC, Shachar Shemesh wrote:
void main() {
struct S {
uint value;
~this() {
}
}
const S a =
On 06/03/18 14:00, Steven Schveighoffer wrote:
On 3/6/18 6:21 AM, Simen Kjærås wrote:
On Tuesday, 6 March 2018 at 10:03:54 UTC, Shachar Shemesh wrote:
void main() {
struct S {
uint value;
~this() {
}
}
const S a = S(12);
S b = a;
}
test.d(10): Error: c
On 3/6/18 6:21 AM, Simen Kjærås wrote:
On Tuesday, 6 March 2018 at 10:03:54 UTC, Shachar Shemesh wrote:
void main() {
struct S {
uint value;
~this() {
}
}
const S a = S(12);
S b = a;
}
test.d(10): Error: cannot implicitly convert expression a of type
c
On 06/03/18 12:16, Diego wrote:
You cannot assign a const element (`a`) to a non-const element (`b`) in
`S b = a` expression.
Sure you can. During assignment you are making a copy. Why do you care
whether the original is const?
Shachar
On Tuesday, 6 March 2018 at 10:03:54 UTC, Shachar Shemesh wrote:
void main() {
struct S {
uint value;
~this() {
}
}
const S a = S(12);
S b = a;
}
test.d(10): Error: cannot implicitly convert expression a of
type const(S) to S
Looks like a bug to me -
On Tuesday, 6 March 2018 at 10:03:54 UTC, Shachar Shemesh wrote:
void main() {
struct S {
uint value;
~this() {
}
}
const S a = S(12);
S b = a;
}
You cannot assign a const element (`a`) to a non-const element
(`b`) in `S b = a` expression. To make de
17 matches
Mail list logo