[Bug c++/44673] static const variable works in if/else, fails at linking in ternary

2012-03-01 Thread pinskia at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44673 Andrew Pinski changed: What|Removed |Added CC||scott at lurndal dot org --- Comment #17

[Bug c++/44673] static const variable works in if/else, fails at linking in ternary

2010-09-28 Thread pinskia at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44673 Andrew Pinski changed: What|Removed |Added CC||derzuomaia at gmail dot com --- Comment #

[Bug c++/44673] static const variable works in if/else, fails at linking in ternary

2010-06-26 Thread redi at gcc dot gnu dot org
--- Comment #15 from redi at gcc dot gnu dot org 2010-06-26 13:46 --- (In reply to comment #14) > > However, it links in the if-else case. The variable is not "used" in the [basic.def.odr] sense, because the lvalue-to-rvalue conversion occurs immediately. > I understand that ?: may be

[Bug c++/44673] static const variable works in if/else, fails at linking in ternary

2010-06-26 Thread manu at gcc dot gnu dot org
--- Comment #14 from manu at gcc dot gnu dot org 2010-06-26 10:53 --- > (In reply to comment #12) > > So is g++ accepting invalid code? > > Yes, but it's a violation of the ODR, no diagnostic is required (it's not > possible to tell until link time that there's no definition.) > > The

[Bug c++/44673] static const variable works in if/else, fails at linking in ternary

2010-06-26 Thread redi at gcc dot gnu dot org
--- Comment #13 from redi at gcc dot gnu dot org 2010-06-26 10:38 --- (In reply to comment #11) > definition Bah, that entity is the "fi" ligature, it should say definition (In reply to comment #12) > So is g++ accepting invalid code? Yes, but it's a violation of the ODR, no diagnosti

[Bug c++/44673] static const variable works in if/else, fails at linking in ternary

2010-06-26 Thread manu at gcc dot gnu dot org
--- Comment #12 from manu at gcc dot gnu dot org 2010-06-26 10:35 --- (In reply to comment #11) > [class.static.data]/3 > If a static data member is of const literal type, its declaration in the class > definition can specify a brace-or-equal-initializer ... The member shall > still be de

[Bug c++/44673] static const variable works in if/else, fails at linking in ternary

2010-06-26 Thread redi at gcc dot gnu dot org
--- Comment #11 from redi at gcc dot gnu dot org 2010-06-26 10:33 --- [class.static.data]/3 If a static data member is of const literal type, its declaration in the class definition can specify a brace-or-equal-initializer ... The member shall still be defined in a namespace scope if it is

[Bug c++/44673] static const variable works in if/else, fails at linking in ternary

2010-06-26 Thread redi at gcc dot gnu dot org
--- Comment #10 from redi at gcc dot gnu dot org 2010-06-26 10:26 --- I disagree that it would be useful, it would encourage non-portable code, and I'd rather be told about the missing definition. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44673

[Bug c++/44673] static const variable works in if/else, fails at linking in ternary

2010-06-25 Thread manu at gcc dot gnu dot org
-- manu at gcc dot gnu dot org changed: What|Removed |Added Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 GCC build triple

[Bug c++/44673] static const variable works in if/else, fails at linking in ternary

2010-06-25 Thread manu at gcc dot gnu dot org
--- Comment #9 from manu at gcc dot gnu dot org 2010-06-26 00:30 --- Then, I reopen this as an enhancement request. If you ever find/redo the patch or someone else decides to fix this in the same way, it would a nice improvement for usability. -- manu at gcc dot gnu dot org changed:

[Bug c++/44673] static const variable works in if/else, fails at linking in ternary

2010-06-25 Thread pinskia at gcc dot gnu dot org
--- Comment #8 from pinskia at gcc dot gnu dot org 2010-06-26 00:25 --- (In reply to comment #7) > (In reply to comment #4) > > In the case of if, the value was "inlined" and in the case of ?:, it is > > not. I > > had a patch which changed the behavior but lost it when I moved compani

[Bug c++/44673] static const variable works in if/else, fails at linking in ternary

2010-06-25 Thread manu at gcc dot gnu dot org
--- Comment #7 from manu at gcc dot gnu dot org 2010-06-26 00:18 --- (In reply to comment #4) > In the case of if, the value was "inlined" and in the case of ?:, it is not. > I > had a patch which changed the behavior but lost it when I moved companies. And what did your patch do exac

[Bug c++/44673] static const variable works in if/else, fails at linking in ternary

2010-06-25 Thread redi at gcc dot gnu dot org
--- Comment #6 from redi at gcc dot gnu dot org 2010-06-25 23:08 --- in this variation the result is not an lvalue, so you can get away without a definition: (b == 0) ? (int)VAR1 : VAR2 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44673

[Bug c++/44673] static const variable works in if/else, fails at linking in ternary

2010-06-25 Thread redi at gcc dot gnu dot org
--- Comment #5 from redi at gcc dot gnu dot org 2010-06-25 23:05 --- The result of "(b == 0) ? VAR1 : VAR2" is an lvalue, that's the difference between the two cases. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44673

[Bug c++/44673] static const variable works in if/else, fails at linking in ternary

2010-06-25 Thread pinskia at gcc dot gnu dot org
--- Comment #4 from pinskia at gcc dot gnu dot org 2010-06-25 21:47 --- In the case of if, the value was "inlined" and in the case of ?:, it is not. I had a patch which changed the behavior but lost it when I moved companies. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44673

[Bug c++/44673] static const variable works in if/else, fails at linking in ternary

2010-06-25 Thread Hodapp87 at gmail dot com
--- Comment #3 from Hodapp87 at gmail dot com 2010-06-25 21:45 --- (In reply to comment #1) > You need indeed a definition. > Why does it require a definition in the ternary case, but not in the if/else? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44673

[Bug c++/44673] static const variable works in if/else, fails at linking in ternary

2010-06-25 Thread pinskia at gcc dot gnu dot org
--- Comment #2 from pinskia at gcc dot gnu dot org 2010-06-25 21:32 --- Note if case does not need a diagnostic according to the C++ standard. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44673

[Bug c++/44673] static const variable works in if/else, fails at linking in ternary

2010-06-25 Thread rguenth at gcc dot gnu dot org
--- Comment #1 from rguenth at gcc dot gnu dot org 2010-06-25 21:31 --- You need indeed a definition. -- rguenth at gcc dot gnu dot org changed: What|Removed |Added