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; 10+ 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] 10+ messages in thread

* [Bug c++/14404] static const integral member cannot be passed as const reference
  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 ` pcarlini at suse dot de
  2004-09-26  4:37 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: pcarlini at suse dot de @ 2004-03-03  9:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pcarlini at suse dot de  2004-03-03 09:52 -------
Not a bug. We are talking about a static member, therefore, in general, you
initialize it outside the class definition:
struct Foo { static const unsigned value; };
const unsigned Foo::value = 1024;
Alternately, for integral types, you can *initialize* within the class body:
struct Foo { static const unsigned value = 1024; };
const unsigned Foo::value;

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


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


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

* [Bug c++/14404] static const integral member cannot be passed as const reference
  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
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-26  4:37 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-26 04:37 -------
*** Bug 17673 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jerrydy at sbcglobal dot net


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


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

* [Bug c++/14404] static const integral member cannot be passed as const reference
  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
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-26  4:38 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-26 04:38 -------
*** Bug 15244 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |militzer at gl dot ciw dot
                   |                            |edu


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


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

* [Bug c++/14404] static const integral member cannot be passed as const reference
  2004-03-03  9:03 [Bug c++/14404] New: static const integral member cannot be passed as const reference saurik at saurik dot com
                   ` (2 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-26  4:39 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-26 04:39 -------
*** Bug 13259 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lev at cs dot technion dot
                   |                            |ac dot il


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


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

* [Bug c++/14404] static const integral member cannot be passed as const reference
  2004-03-03  9:03 [Bug c++/14404] New: static const integral member cannot be passed as const reference saurik at saurik dot com
                   ` (3 preceding siblings ...)
  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
  6 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-28  2:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-04-28 02:04 -------
*** Bug 15839 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |igodard at pacbell dot net


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


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

* [Bug c++/14404] static const integral member cannot be passed as const reference
  2004-03-03  9:03 [Bug c++/14404] New: static const integral member cannot be passed as const reference saurik at saurik dot com
                   ` (4 preceding siblings ...)
  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
  6 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-28  2:07 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-04-28 02:03 -------
*** Bug 13051 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mihai_preda at yahoo dot com


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


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

* [Bug c++/14404] static const integral member cannot be passed as const reference
  2004-03-03  9:03 [Bug c++/14404] New: static const integral member cannot be passed as const reference saurik at saurik dot com
                   ` (5 preceding siblings ...)
  2005-04-28  2:07 ` pinskia at gcc dot gnu dot org
@ 2005-05-30 21:56 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-30 21:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-30 21:48 -------
*** Bug 21832 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bernie at develer dot com


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


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

* [Bug c++/14404] static const integral member cannot be passed as const reference
       [not found] <bug-14404-4@http.gcc.gnu.org/bugzilla/>
@ 2011-01-21 14:09 ` redi at gcc dot gnu.org
  0 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2011-01-21 14:09 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aishen944 at 163 dot com

--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-01-21 14:04:20 UTC ---
*** Bug 47396 has been marked as a duplicate of this bug. ***


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

* [Bug c++/14404] static const integral member cannot be passed as const reference
       [not found] <bug-14404-8018@http.gcc.gnu.org/bugzilla/>
@ 2005-11-26 23:02 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-11-26 23:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pinskia at gcc dot gnu dot org  2005-11-26 23:02 -------
*** Bug 25108 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pluto at agmk dot net


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


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

end of thread, other threads:[~2011-01-21 14:05 UTC | newest]

Thread overview: 10+ 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
     [not found] <bug-14404-8018@http.gcc.gnu.org/bugzilla/>
2005-11-26 23:02 ` pinskia at gcc dot gnu dot org
     [not found] <bug-14404-4@http.gcc.gnu.org/bugzilla/>
2011-01-21 14:09 ` redi at gcc dot gnu.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).