public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/22095] New: static template class member definition doesn't compile
@ 2005-06-16 19:55 zappa at yandex-team dot ru
  2005-06-16 20:01 ` [Bug c++/22095] " bangerth at dealii dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: zappa at yandex-team dot ru @ 2005-06-16 19:55 UTC (permalink / raw)
  To: gcc-bugs

# 1 "test.cpp"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "test.cpp"
template <typename key>
class sample {
    public:
        typedef key keytype;
    private:
        static keytype * keyptr;
};

typedef sample<int> intsample;
intsample::keytype * intsample::keyptr = 0;

int main(int argc, char ** argv) {
    return 0;
}
fails with 3.4.4 and 4.0.1 Namely:
$ g++-4.0 -v -save-temps -o test test.cpp
Using built-in specs.
Target: i486-linux
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib --enable-nls
--without-included-gettext --enable-threads=posix --program-suffix=-4.0
--enable-__cxa_atexit --enable-libstdcxx-allocator=mt --enable-clocale=gnu
--enable-libstdcxx-debug --enable-java-gc=boehm --enable-java-awt=gtk
--enable-mpfr --disable-werror --enable-checking=release i486-linux
Thread model: posix
gcc version 4.0.1 20050522 (prerelease) (Debian 4.0.0-9)
 /usr/lib/gcc/i486-linux/4.0.1/cc1plus -E -quiet -v -D_GNU_SOURCE test.cpp
-mtune=i486 -fpch-preprocess -o test.ii
ignoring nonexistent directory
"/usr/lib/gcc/i486-linux/4.0.1/../../../../i486-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/i486-linux/4.0.1/../../../../include/c++/4.0.1
 /usr/lib/gcc/i486-linux/4.0.1/../../../../include/c++/4.0.1/i486-linux
 /usr/lib/gcc/i486-linux/4.0.1/../../../../include/c++/4.0.1/backward
 /usr/local/include
 /usr/lib/gcc/i486-linux/4.0.1/include
 /usr/include
End of search list.
 /usr/lib/gcc/i486-linux/4.0.1/cc1plus -fpreprocessed test.ii -quiet -dumpbase
test.cpp -mtune=i486 -auxbase test -version -o test.s
GNU C++ version 4.0.1 20050522 (prerelease) (Debian 4.0.0-9) (i486-linux)
        compiled by GNU C version 4.0.1 20050522 (prerelease) (Debian 4.0.0-9).
GGC heuristics: --param ggc-min-expand=62 --param ggc-min-heapsize=60432
test.cpp:10: error: too few template-parameter-lists

while with 3.3 family the same code compiles perfectly

-- 
           Summary: static template class member definition doesn't compile
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: zappa at yandex-team dot ru
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: Debian linux i386
GCC target triplet: 4.0.1


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


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

* [Bug c++/22095] static template class member definition doesn't compile
  2005-06-16 19:55 [Bug c++/22095] New: static template class member definition doesn't compile zappa at yandex-team dot ru
@ 2005-06-16 20:01 ` bangerth at dealii dot org
  2005-06-16 20:03 ` pinskia at gcc dot gnu dot org
  2005-06-16 20:12 ` zappa at yandex-team dot ru
  2 siblings, 0 replies; 4+ messages in thread
From: bangerth at dealii dot org @ 2005-06-16 20:01 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2005-06-16 20:00 -------
The typedef you use is still a specialization of a template, so you 
have to write 
 
template <> intsample::keytype * intsample::keyptr = 0; 
 
With this, it works. 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

* [Bug c++/22095] static template class member definition doesn't compile
  2005-06-16 19:55 [Bug c++/22095] New: static template class member definition doesn't compile zappa at yandex-team dot ru
  2005-06-16 20:01 ` [Bug c++/22095] " bangerth at dealii dot org
@ 2005-06-16 20:03 ` pinskia at gcc dot gnu dot org
  2005-06-16 20:12 ` zappa at yandex-team dot ru
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-16 20:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-16 20:02 -------
This is invalid.

You want the follwoing instead:
template<> intsample::keytype * intsample::keyptr = 0;

-- 


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


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

* [Bug c++/22095] static template class member definition doesn't compile
  2005-06-16 19:55 [Bug c++/22095] New: static template class member definition doesn't compile zappa at yandex-team dot ru
  2005-06-16 20:01 ` [Bug c++/22095] " bangerth at dealii dot org
  2005-06-16 20:03 ` pinskia at gcc dot gnu dot org
@ 2005-06-16 20:12 ` zappa at yandex-team dot ru
  2 siblings, 0 replies; 4+ messages in thread
From: zappa at yandex-team dot ru @ 2005-06-16 20:12 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From zappa at yandex-team dot ru  2005-06-16 20:12 -------
Thank you a lot!
I'm sorry to report a false bug.
Just used with older version and thought that found a regression.

-- 


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


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

end of thread, other threads:[~2005-06-16 20:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-16 19:55 [Bug c++/22095] New: static template class member definition doesn't compile zappa at yandex-team dot ru
2005-06-16 20:01 ` [Bug c++/22095] " bangerth at dealii dot org
2005-06-16 20:03 ` pinskia at gcc dot gnu dot org
2005-06-16 20:12 ` zappa at yandex-team dot ru

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).