public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/9048] Conditional expression error with static const members
       [not found] <20021223143600.9048.jmc@xisl.com>
@ 2004-03-18 23:35 ` hull at paracel dot com
  2004-03-19  1:29 ` pinskia at gcc dot gnu dot org
  2004-03-19 19:51 ` hull at paracel dot com
  2 siblings, 0 replies; 3+ messages in thread
From: hull at paracel dot com @ 2004-03-18 23:35 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From hull at paracel dot com  2004-03-18 23:35 -------
I just ran into this bug.

By my reading of the C++ standard, I do not believe that an out-of-definition
should be necessary for a "static const int" class variable.  See Section
9.4.2 "Static data members", specifically paragraph 4.

It is true that the bug can be worked around by turning the conditional
expression "a = (c ? X : Y)" into "if (c) { a = X; } else { a = Y; }".

-- 


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


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

* [Bug c++/9048] Conditional expression error with static const members
       [not found] <20021223143600.9048.jmc@xisl.com>
  2004-03-18 23:35 ` [Bug c++/9048] Conditional expression error with static const members hull at paracel dot com
@ 2004-03-19  1:29 ` pinskia at gcc dot gnu dot org
  2004-03-19 19:51 ` hull at paracel dot com
  2 siblings, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-19  1:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-03-19 01:29 -------
No that says it can be optimized away but you still need it, anyways the optimization was added for 
3.4.0 of gcc.

-- 


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


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

* [Bug c++/9048] Conditional expression error with static const members
       [not found] <20021223143600.9048.jmc@xisl.com>
  2004-03-18 23:35 ` [Bug c++/9048] Conditional expression error with static const members hull at paracel dot com
  2004-03-19  1:29 ` pinskia at gcc dot gnu dot org
@ 2004-03-19 19:51 ` hull at paracel dot com
  2 siblings, 0 replies; 3+ messages in thread
From: hull at paracel dot com @ 2004-03-19 19:51 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From hull at paracel dot com  2004-03-19 19:51 -------
I now understand why it isn't a bug.

Even though class foo says

  class foo {
      static const int bar1 = 1, bar2 = 2;
      ...
  };

it is also necessary to write

  const int foo::bar1, foo::bar2;

This is what Nathan Sidwell's comment was saying, but I didn't
understand it.  This means that "static const int" is not quite
the complete replacement for "#define" that I misunderstood it
to be because it's not a header-only solution.

Thank you for your patience.



-- 


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


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

end of thread, other threads:[~2004-03-19 19:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20021223143600.9048.jmc@xisl.com>
2004-03-18 23:35 ` [Bug c++/9048] Conditional expression error with static const members hull at paracel dot com
2004-03-19  1:29 ` pinskia at gcc dot gnu dot org
2004-03-19 19:51 ` hull at paracel dot com

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