public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "leslie dot barnes at amd dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/17445] too few template-parameter-lists
Date: Mon, 18 Apr 2005 06:38:00 -0000	[thread overview]
Message-ID: <20050418063825.3708.qmail@sourceware.org> (raw)
In-Reply-To: <20040913003933.17445.carlson14@llnl.gov>


------- Additional Comments From leslie dot barnes at amd dot com  2005-04-18 06:38 -------
(In reply to comment #2)
> You want:
> template<>
> MyType<Sample> list;
> char *MyType<Sample>::name = "Hello\n";

 The following code seg faults with g++ 3.4.3.  If I remove the "template <>",
it won't compile.  On g++ 3.3, without the "template <>" it is happy and prints
"goodbye".  With the "template <>" it also seg faults.

 I'd like to know if this is a bug, or my inability to figure out the correct
syntax.

 thanks


#include <cstdio>
#include <map>
template <class T> class MyType {
public:
    static std::map<char*,char*> m_map;
};
 
class Sample {
};
 
template class MyType<Sample>;
template <> std::map<char*,char*> MyType<Sample>::m_map;
 
int main(int argc, char **argv) {
    MyType<Sample>::m_map["hello"]="goodbye";
    printf("%s\n",MyType<Sample>::m_map["hello"]);
}


-- 


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


  parent reply	other threads:[~2005-04-18  6:38 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-13  0:39 [Bug c++/17445] New: " carlson14 at llnl dot gov
2004-09-13  1:03 ` [Bug c++/17445] " pinskia at gcc dot gnu dot org
2004-09-13  1:03 ` pinskia at gcc dot gnu dot org
2005-04-18  6:38 ` leslie dot barnes at amd dot com [this message]
2005-04-18  9:08 ` giovannibajo at libero dot it
2005-04-18 13:37 ` leslie dot barnes at amd dot com
2005-04-18 20:16 ` bangerth at dealii dot org
2005-04-19  0:02 ` leslie dot barnes at amd dot com
2005-04-19 14:08 ` bangerth at dealii dot org
2005-04-25  4:10 ` pinskia at gcc dot gnu dot org
2005-04-25  4:13 ` pinskia at gcc dot gnu dot org
2005-04-25  4:15 ` pinskia at gcc dot gnu dot org
2005-04-25  4:19 ` pinskia at gcc dot gnu dot org
2005-07-28 18:51 ` owen at titan dot com
2005-07-28 19:54 ` bangerth at dealii dot org

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=20050418063825.3708.qmail@sourceware.org \
    --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).