You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafficserver.apache.org by "John Plevyak (JIRA)" <ji...@apache.org> on 2010/03/01 23:10:05 UTC

[jira] Updated: (TS-125) Cannot use user-defined types in typedef of template function

     [ https://issues.apache.org/jira/browse/TS-125?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

John Plevyak updated TS-125:
----------------------------

    Attachment: ts-125-offsetof-jp-v1.patch

This patch converts the use of offsetof in List.h into the
use of a template argument to handle specialization
of SLL/DLL/Queue wrt the Link field.

This should address the problem with compilation using SunCC
and other truely lame compilers that insist on throwing errors
on otherwise perfectly good code just because the spec permits
them to.

With GCC 4.4 at least, this change produces exactly the same efficient code
on test_List.cc.

> Cannot use user-defined types in typedef of template function
> -------------------------------------------------------------
>
>                 Key: TS-125
>                 URL: https://issues.apache.org/jira/browse/TS-125
>             Project: Traffic Server
>          Issue Type: Bug
>          Components: Portability
>         Environment: OpenSolaris with SunStudio (gcc on opensolaris fails the same code with a different error; same workaround fixes it)
>            Reporter: Nick Kew
>            Priority: Critical
>         Attachments: ts-125-offsetof-jp-v1.patch
>
>
> This appears to be related to Sun bug http://bugs.sun.com/view_bug.do?bug_id=6906118
> but is sufficiently different that the workaround suggested there doesn't apply.
> Compiling DAllocator.h produces the following fatal error:
> "DAllocator.h", line 86: Error: Unexpected type name "AllocPoolDescriptor" encountered.
> "DAllocator.h", line 87: Error: Unexpected type name "AllocDescriptor" encountered.
> It can be worked around by reverting:
> @@ -83,8 +83,8 @@
>    int alignment;
>    int el_size;
>  
> -  SList(AllocPoolDescriptor,link) pools;
> -  Que(AllocDescriptor,link) free_list;
> +  SLL<AllocPoolDescriptor> pools;
> +  Queue<AllocDescriptor> free_list;
> Expanding that with the -E option to CC reveals that this loses an offsetof argument, so if we could fix the offset to zero then the problem goes away.  If at all possible, it would be good to make "link" the first element of AllocDescriptor and AllocPoolDescriptor so the need for offsetof goes away.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.