This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/20547] undefined reference to "static const" fields of classes


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]