[Issue 5105] New: Member function template cannot be synchronized
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Oct 23 00:54:38 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5105
Summary: Member function template cannot be synchronized
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: patch, rejects-valid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: rsinfu at gmail.com
--- Comment #0 from Shin Fujishiro <rsinfu at gmail.com> 2010-10-23 00:53:54 PDT ---
DMD doesn't allow member function templates in synchronized class:
--------------------
void main()
{
auto c = new C;
c.foo(10); // (4)
}
synchronized shared class C
{
void foo(T)(T a) {} // (8)
}
--------------------
test.d(8): Error: function test.C.foo!(int).foo synchronized function foo must
be a member of a class
test.d(4): Error: template instance test.C.foo!(int) error instantiating
--------------------
Patch against dmd r727:
--------------------
--- src/func.c
+++ src/func.c
@@ -1551,7 +1551,8 @@ void FuncDeclaration::semantic3(Scope *sc)
if (isSynchronized())
{ /* Wrap the entire function body in a synchronized statement
*/
- ClassDeclaration *cd = parent->isClassDeclaration();
+ AggregateDeclaration *ad = isThis();
+ ClassDeclaration *cd = ad ? ad->isClassDeclaration() : NULL;
if (cd)
{
#if TARGET_WINDOS
--------------------
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list