public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "trumsko at yahoo dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/31378]  New: "too few template-parameter-lists" when initializing static template member
Date: Tue, 27 Mar 2007 18:43:00 -0000	[thread overview]
Message-ID: <bug-31378-12424@http.gcc.gnu.org/bugzilla/> (raw)

When compiling the following program the g++ 4.1.0 gives the error message:
"testtemplstatic.cpp:22: error: too few template-parameter-lists". Which I
interprete as a complaint, that a "template<>" is missing.
If I uncomment the "template<>" in line 21 g++ prints the error message:
"testtemplstatic.cpp:22: error: template header not allowed in member
definition of explicitly specialized class", which I interprete as having a
"template<>" too much.
One of the both versions (presumably the first) should be correct.

My configuration:
> g++ -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.1.0/configure
--prefix=/flc/flc03/data/samson/soft/gcc/4.1.0 --enable-languages=c,c++
Thread model: posix
gcc version 4.1.0

Regretfully I cannot check the bug with an 4.1.2 version of g++, as the
compilation of gcc 4.1.2 fails with an linker error on a Scientific Linux
(RHEL3) machine.

Cheers, T.




#include <iostream>

using namespace std;


template< class T >
struct foo
{
  struct bar;
};


template<>
struct foo<int>::bar
{
  const static char* blubb;
};

template struct foo<int>;

//template<>
const char* foo<int>::bar::blubb = "huhu";


int main()
{
  cout << foo<int>::bar::blubb <<endl;
}


-- 
           Summary: "too few template-parameter-lists" when initializing
                    static template member
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: trumsko at yahoo dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


             reply	other threads:[~2007-03-27 18:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-27 18:43 trumsko at yahoo dot com [this message]
2007-03-27 19:03 ` [Bug c++/31378] " pinskia at gcc dot gnu dot org
2007-03-27 19:56 ` trumsko at yahoo dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-31378-12424@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).