While I'm at it, I noticed a behaviour which is not exactly related but similar. To put it simply, you can 't do T.V.W, you need to do !cast<Bla>(T.V).W<br>Example:<br><br>class Bla<string t><br>{<br>    string blu = t;<br>

}<br><br>class Bli<Bla t><br>{<br>    Bla bla = t;<br>}<br><br>def a : Bli<Bla<"">>;<br>def b : Bla<!cast<Bla>(a.bla).blu>; // works<br>def b : Bla<a.bla.blu>; // doesn't work: Cannot access field 'blu' of value 'a.bla'<br>

<br>Although these issue are not the same, there are similar in the sense that any Value of which the type is a class should have a working subfield lookup and should not require a cast. Except if I'm missing something and there is a real issue underneath.<br>

<br clear="all">Amaury Pouly<br>
<br><br><div class="gmail_quote">2010/9/1 Chris Lattner <span dir="ltr"><<a href="mailto:clattner@apple.com">clattner@apple.com</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<div class="im"><br>
On Sep 1, 2010, at 4:35 AM, Amaury Pouly wrote:<br>
<br>
> Hello,<br>
> I was fiddling with TableGen (for a use that has nothing to do with a compiler but it's doesn't matter) and TableGen triggers an assertion failure on this code (I reduced the case to the minimum, it's a parsing bug):<br>


<br>
</div>David, can you take a look?  This is related to your lisp interpreter :)<br>
<br>
-Chris<br>
<div><div></div><div class="h5"><br>
><br>
> class Bli<string _t><br>
> {<br>
>     string t = _t;<br>
> }<br>
><br>
> class Bla<list<Bli> _bli><br>
> : Bli<!car(_bli).t><br>
> {<br>
> }<br>
><br>
> #0  0x00007ffff6ebda75 in *__GI_raise (sig=<value optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64<br>
> #1  0x00007ffff6ec15c0 in *__GI_abort () at abort.c:92<br>
> #2  0x00007ffff6eb6941 in *__GI___assert_fail (assertion=0x5aa663 "0 && \"Unknown unop\"", file=<value optimized out>, line=633,<br>
>     function=0x5abb20 "virtual llvm::RecTy* llvm::UnOpInit::getFieldType(const std::string&) const") at assert.c:81<br>
> #3  0x000000000050ddc8 in llvm::UnOpInit::getFieldType (this=0x850f00, FieldName=...) at Record.cpp:633<br>
> #4  0x0000000000543f64 in llvm::TGParser::ParseValue (this=0x7fffffffd480, CurRec=0x8511d0, ItemType=0x851540) at TGParser.cpp:1342<br>
> #5  0x0000000000544574 in llvm::TGParser::ParseValueList (this=0x7fffffffd480, CurRec=0x8511d0, ArgsRec=0x8510d0, EltTy=0x0) at TGParser.cpp:1405<br>
> #6  0x000000000053e520 in llvm::TGParser::ParseSubClassReference (this=0x7fffffffd480, CurRec=0x8511d0, isDefm=false) at TGParser.cpp:397<br>
> #7  0x00000000005458e5 in llvm::TGParser::ParseObjectBody (this=0x7fffffffd480, CurRec=0x8511d0) at TGParser.cpp:1613<br>
> #8  0x00000000005463ad in llvm::TGParser::ParseClass (this=0x7fffffffd480) at TGParser.cpp:1727<br>
> #9  0x0000000000548b86 in llvm::TGParser::ParseObject (this=0x7fffffffd480, MC=0x0) at TGParser.cpp:2098<br>
> #10 0x0000000000548bbb in llvm::TGParser::ParseObjectList (this=0x7fffffffd480, MC=0x0) at TGParser.cpp:2107<br>
> #11 0x0000000000548c10 in llvm::TGParser::ParseFile (this=0x7fffffffd480) at TGParser.cpp:2115<br>
> #12 0x0000000000550035 in ParseFile (Filename=..., IncludeDirs=..., SrcMgr=...) at TableGen.cpp:196<br>
> #13 0x0000000000550116 in main (argc=3, argv=0x7fffffffe208) at TableGen.cpp:206<br>
><br>
> Looking at the code, it's triggered because UnOpInit::getFieldType only handles the cast<> operator. I don't see a good reason for this given that !car can give a value of which we can access a subfield. Of course, a trivial solution to the problem is to use !cast with !car but this seems ugly to me:<br>


><br>
><br>
> class Bli<string _t><br>
> {<br>
>     string t = _t;<br>
> }<br>
><br>
> class Bla<list<Bli> _bli><br>
> : Bli<!cast<Bli>(!car(_bli)).t><br>
> {<br>
> }<br>
><br>
> Is this a bug or is it the wanted behaviour that a cast must be introduced ?<br>
> Regards<br>
><br>
><br>
> Amaury Pouly<br>
</div></div>> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br>
</blockquote></div><br>