[Issue 5941] Using inner struct which references nested function in a no-attribute or auto-return member function causes nested function cannot be accessed error

2015-06-22 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=5941

Kenji Hara k.hara...@gmail.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |WORKSFORME

--- Comment #6 from Kenji Hara k.hara...@gmail.com ---
(In reply to Maksim Zholudev from comment #5)
 Is this behavior correct?

Currently it's correct. A nested struct is not constructible outside of the
defined function, because it needs valid enclosing context.

I think the original attribute-dependent issue is fixed.

--


[Issue 5941] Using inner struct which references nested function in a no-attribute or auto-return member function causes nested function cannot be accessed error

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5941


Maksim Zholudev maxim...@gmail.com changed:

   What|Removed |Added

 CC||maxim...@gmail.com


--- Comment #5 from Maksim Zholudev maxim...@gmail.com 2013-03-04 09:20:24 
PST ---
Linux, 64-bit
DMD from Git head
https://github.com/D-Programming-Language/dmd/commit/13b3bdbf3819fec810ebfb077957510612dfa815

0.
Compiling code from the description
(http://d.puremagic.com/issues/show_bug.cgi?id=5941#c0):

test.d(11): Error: cannot access frame pointer of test.f.S


1.
Compiling code from comment 1
(http://d.puremagic.com/issues/show_bug.cgi?id=5941#c1):

test.d(11): Error: cannot access frame pointer of test.f!(function void()
{
}
).f.S


2.
Compiling code from comment 2
(http://d.puremagic.com/issues/show_bug.cgi?id=5941#c1):

test.d(9): Error: cannot access frame pointer of test.fx.S


Is this behavior correct?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 5941] Using inner struct which references nested function in a no-attribute or auto-return member function causes nested function cannot be accessed error

2012-01-18 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5941


yebblies yebbl...@gmail.com changed:

   What|Removed |Added

 CC||yebbl...@gmail.com


--- Comment #4 from yebblies yebbl...@gmail.com 2012-01-19 14:04:52 EST ---
In case anyone's wondering about why adding attributes changes anything, the
compiler does a scan of all the top level members in a nested struct to
determine if it contains any functions, and makes it a static struct otherwise.
 This is unfortunately done badly/too early and it finds AttributeDeclarations
containing functions but doesn't investigate further.
Given that, it sounds like the requirement for having no attributes is really
just a requirement for a non-static nested struct.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 5941] Using inner struct which references nested function in a no-attribute or auto-return member function causes nested function cannot be accessed error

2011-12-21 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5941


Don clugd...@yahoo.com.au changed:

   What|Removed |Added

 CC||clugd...@yahoo.com.au


--- Comment #2 from Don clugd...@yahoo.com.au 2011-12-21 14:35:39 PST ---
Reduced test case suggests it's related to typeof():

auto fx() {
struct S {
void get() {}
}
return S.init;
}
void main() {
//auto w = fx(); // OK
typeof(fx()) z;  // fails!
}

Again, adding any attributes to get() removes the bug -- even though get() is
never used.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 5941] Using inner struct which references nested function in a no-attribute or auto-return member function causes nested function cannot be accessed error

2011-12-21 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5941


Don clugd...@yahoo.com.au changed:

   What|Removed |Added

   Keywords||accepts-invalid


--- Comment #3 from Don clugd...@yahoo.com.au 2011-12-21 23:30:26 PST ---
In bug 5939, Walter explicitly stated that the test case is comment 2 is not a
bug. However, the fact that it compiles if the function 'get' is removed, or if
attributes are added to get(), is surely a bug. Based on Walter's comment, it
should never compile. So I'm marking as accepts-invalid.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 5941] Using inner struct which references nested function in a no-attribute or auto-return member function causes nested function cannot be accessed error

2011-05-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5941



--- Comment #1 from kenn...@gmail.com 2011-05-07 00:27:39 PDT ---
A slight variant is when 'f' is a template function taking a delegate literal
as input, it will generate an ICE:

-
auto f(alias T)() {
static void h(){}
struct S {
void get() {
h();
}
}
return S();
}
void main() {
typeof(f!((){})()) z;
}
-
Internal error: backend/cgcs.c 363
-

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---