public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/14404] New: static const integral member cannot be passed as const reference
@ 2004-03-03  9:03 saurik at saurik dot com
  2004-03-03  9:52 ` [Bug c++/14404] " pcarlini at suse dot de
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: saurik at saurik dot com @ 2004-03-03  9:03 UTC (permalink / raw)
  To: gcc-bugs

It might be that I just don't understand the standard well enough, but I would 
have expected the following code to have worked. I'm assuming it fails because 
I'm taking a reference of a variable that I didn't explicitely instantiate 
outside the class, but considering if I replace Foo::value with the constant 
1024 it would work I seems as if this construct should be accepted as well.

void doit(const unsigned &) {}
struct Foo { static const unsigned value = 1024; };
int main() { doit(Foo::value); return 0; }

/tmp/ccmjMvPb.o(.text+0x25): In function `main':
: undefined reference to `Foo::value'
collect2: ld returned 1 exit status

-- 
           Summary: static const integral member cannot be passed as const
                    reference
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: saurik at saurik dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

end of thread, other threads:[~2005-05-30 21:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-03  9:03 [Bug c++/14404] New: static const integral member cannot be passed as const reference saurik at saurik dot com
2004-03-03  9:52 ` [Bug c++/14404] " pcarlini at suse dot de
2004-09-26  4:37 ` pinskia at gcc dot gnu dot org
2004-09-26  4:38 ` pinskia at gcc dot gnu dot org
2004-09-26  4:39 ` pinskia at gcc dot gnu dot org
2005-04-28  2:05 ` pinskia at gcc dot gnu dot org
2005-04-28  2:07 ` pinskia at gcc dot gnu dot org
2005-05-30 21:56 ` pinskia at gcc dot gnu dot org

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