public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "Hu dot YuehWei at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/20547] undefined reference to "static const" fields of classes
Date: Sat, 19 Mar 2005 14:16:00 -0000	[thread overview]
Message-ID: <20050319141559.1820.qmail@sourceware.org> (raw)
In-Reply-To: <20050319065920.20547.Hu.YuehWei@gmail.com>


------- Additional Comments From Hu dot YuehWei at gmail dot com  2005-03-19 14:15 -------
I understand what you mean.
But why the following codes works:

#include <iostream>
#include <vector>

struct T
{
  static char const a = 3;
};

std::vector<char> ddd;

int
main()
{
  ddd.push_back(static_cast<char>(T::a)); // <========= here

  std::cerr << ddd.front() << std::endl;

  return 0;
}

and if I pass an constant to a function which takes its address,
then why the folloing codes doesn't produce errors?

void
fff(char const &a)
{
}

int
main()
{
  fff(4);

  return 0;
}


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


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


  parent reply	other threads:[~2005-03-19 14:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-19  6:59 [Bug c++/20547] New: " Hu dot YuehWei at gmail dot com
2005-03-19 13:45 ` [Bug c++/20547] " pinskia at gcc dot gnu dot org
2005-03-19 13:53 ` Hu dot YuehWei at gmail dot com
2005-03-19 14:01 ` Hu dot YuehWei at gmail dot com
2005-03-19 14:03 ` pinskia at gcc dot gnu dot org
2005-03-19 14:16 ` Hu dot YuehWei at gmail dot com [this message]
2005-03-19 14:34 ` pinskia at gcc dot gnu dot org
2005-03-19 18:26 ` Hu dot YuehWei at gmail dot com
2005-03-19 18:36 ` pinskia at gcc dot gnu dot org
2005-03-20  7:59 ` Hu dot YuehWei at gmail dot com
2005-03-20 13:55 ` lerdsuwa at gcc dot gnu dot org
     [not found] <bug-20547-10303@http.gcc.gnu.org/bugzilla/>
2006-09-25 21:11 ` pinskia at gcc dot gnu 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=20050319141559.1820.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).