[Issue 4042] Unable to instantiate a struct template.

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

Andrei Alexandrescu and...@erdani.com changed:

   What|Removed |Added

Version|2.040   |D2

--


[Issue 4042] Unable to instantiate a struct template.

2010-05-18 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4042


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

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #9 from Don clugd...@yahoo.com.au 2010-05-18 12:18:38 PDT ---
FixedDMD2.046.

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


[Issue 4042] Unable to instantiate a struct template.

2010-05-10 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4042



--- Comment #6 from Eldar Insafutdinov e.insafutdi...@gmail.com 2010-05-10 
03:31:35 PDT ---
(In reply to comment #5)
 changelog 477

Thanks for that. I will check if it fixes our problem later today. And I am
also looking forward to properly fix of forward references. This particular bug
may be fixed, but who knows if other will appear. It still persists as a
serious problem to me. Eliminating forward references completely will increase
the quality of the compiler significantly.

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


[Issue 4042] Unable to instantiate a struct template.

2010-05-10 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4042



--- Comment #7 from Max Samukha samu...@voliacable.com 2010-05-10 07:45:38 
PDT ---
*** Issue 4043 has been marked as a duplicate of this issue. ***

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


[Issue 4042] Unable to instantiate a struct template.

2010-05-10 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4042



--- Comment #8 from Max Samukha samu...@voliacable.com 2010-05-10 08:01:05 
PDT ---
(In reply to comment #5)
 changelog 477

Qtd compiles with that. Thank you.

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


[Issue 4042] Unable to instantiate a struct template.

2010-05-09 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4042


Walter Bright bugzi...@digitalmars.com changed:

   What|Removed |Added

 CC||bugzi...@digitalmars.com


--- Comment #3 from Walter Bright bugzi...@digitalmars.com 2010-05-09 
17:56:02 PDT ---
Thanks for the reduced test case.

This is a rather nasty problem. The essence of it is that when the
is(T.__isQObjectType) is evaluated, T is forward referenced. So it attempts to
forward instantiate T. This fails, and so the IsExpression fails.

The problem is that in the attempt to forward instantiate T, it doesn't quite
reset itself back to the state it was in before the IsExpression, and now parts
of the symbol table are in an error state, and a cascaded error message
(hence incomprehensible) comes out as a result.

A workaround is to remove 'abstract' from the class declaration, which enables
the forward instantiation to succeed.

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


[Issue 4042] Unable to instantiate a struct template.

2010-05-09 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4042



--- Comment #4 from Walter Bright bugzi...@digitalmars.com 2010-05-09 
19:53:56 PDT ---
Trying to perfectly unwind forward reference failures is buggy and probably
doomed. This one fails because function parameter types don't get redone. While
it's easy to fix that one, there are just more lurking. A better approach is to
make forward references always work, something I've been working towards for a
while.

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


[Issue 4042] Unable to instantiate a struct template.

2010-05-09 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4042



--- Comment #5 from Walter Bright bugzi...@digitalmars.com 2010-05-09 
20:00:03 PDT ---
changelog 477

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


[Issue 4042] Unable to instantiate a struct template.

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


Max Samukha samu...@voliacable.com changed:

   What|Removed |Added

 CC||samu...@voliacable.com


--- Comment #1 from Max Samukha samu...@voliacable.com 2010-04-03 05:01:52 
PDT ---
A corrected and smaller test-case:

template isQObjectType(T)
{
enum isQObjectType = is(T.__isQObjectType);
}

template QTypeInfo(T)
{
static if (!isQObjectType!T)
{   
enum size = T.sizeof;
}
}

struct QList(T)
{
alias QTypeInfo!T TI;
int x;

void foo()
{
x++;
}
}

void exec(QList!(QAction) actions) {}

interface IQGraphicsItem
{
}

abstract class QGraphicsObject : IQGraphicsItem
{
}

class QGraphicsWidget : QGraphicsObject
{
}

class QAction
{
final void associatedGraphicsWidgets(QList!(QGraphicsWidget) a)
{
QList!(QGraphicsWidget) x;
}
}

void main()
{
}


There may be more than one bug. Note that the static if body in QTypeInfo is
evaluated even though no __isQObjectType is defined in QGraphicsWidget or
QAction.

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


[Issue 4042] Unable to instantiate a struct template.

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



--- Comment #2 from Max Samukha samu...@voliacable.com 2010-04-03 05:25:22 
PDT ---
 There may be more than one bug. Note that the static if body in QTypeInfo is
 evaluated even though no __isQObjectType is defined in QGraphicsWidget or
 QAction.

Ignore that part. It's the other way around. If we add, for example, alias
void __isQObjectType; to QGraohicsWidget/QAction, the static if condition is
satisfied in QTypeInfo, though it should not.

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


Re: [Issue 4042] Unable to instantiate a struct template.

2010-04-03 Thread wrzosk

The test case compiles when exec method definition is moved down:
template isQObjectType(T)
{
enum isQObjectType = is(T.__isQObjectType);
}

template QTypeInfo(T)
{
static if (!isQObjectType!T)
{
enum size = T.sizeof;
}
}

struct QList(T)
{
alias QTypeInfo!T TI;
int x;

void foo()
{
x++;
}
}


interface IQGraphicsItem
{
}
void exec(QList!(QAction) actions) {}

abstract class QGraphicsObject : IQGraphicsItem
{
}

class QGraphicsWidget : QGraphicsObject
{
}

class QAction
{
final void associatedGraphicsWidgets(QList!(QGraphicsWidget) a)
{
QList!(QGraphicsWidget) x;
}
}

void main()
{
}