public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/37657]  New: static template member definition fails when parameter is another template
@ 2008-09-27  4:47 robertohjdasilva at hotmail dot com
  2008-10-03 20:29 ` [Bug c++/37657] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: robertohjdasilva at hotmail dot com @ 2008-09-27  4:47 UTC (permalink / raw)
  To: gcc-bugs

+++ This bug was initially created as a clone of Bug #14132 +++

Hello,

 I would like to start from the final solution presented for Bug # 14132 copied
below for reference:

So when the old code looks like:
| 
|   int A<void>::a;
| 
| it must be replaced by:
| 
|   template class A<void>;
|   template<class T> int A<T>::a;

Reverse the order:

   (1) provide the template definition of the static data member
   (2) instantiate the class.

In our case, this type of construct works as described for the case where the
parameter for the template member definition is a class, structure or native
type. For instance:

The following code was building and running fine in GCC 3.3 on Power PC.

pool_t memdat_t<mem_t, small>::pool;

Using the technique depicted in this bug, I have converted that into the code
below:

template class  memdat_t<mem_t, small>;
template<class T, unsigned int U> pool_t memdat_t<T, U>::pool;

This code builds and runs on both GCC 3.3 (PPC) and GCC 3.4 (ARM).

If I now have a code that is a little bit more complicated, like the one below,
things get tough.

pool_t memdat_t<addr_type_t<ipv4_addr_t>, huge>::pool;
pool_t memdat_t<addr_type_t<ipv6_addr_t>, huge>::pool;

I need to define two static members that will be differentiated based on the
address family (IPv4 or IPv6).

The issue is that one of the parameters of the static template member is
another template (addr_type_t<ipv4_addr_t> or addr_type_t).

I have not been able to figure out a way to write this code in such a way that
it works (compiles and links correctly) for both GCC 3.3 and 3.4. 


Thanks in Advance,
rds


-- 
           Summary: static template member definition fails when parameter
                    is another template
           Product: gcc
           Version: 3.4.4
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: robertohjdasilva at hotmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37657


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/37657] static template member definition fails when parameter is another template
  2008-09-27  4:47 [Bug c++/37657] New: static template member definition fails when parameter is another template robertohjdasilva at hotmail dot com
@ 2008-10-03 20:29 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-10-03 20:29 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |normal


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37657


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-10-03 20:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-27  4:47 [Bug c++/37657] New: static template member definition fails when parameter is another template robertohjdasilva at hotmail dot com
2008-10-03 20:29 ` [Bug c++/37657] " pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).