public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13259] New: link fails, if static const is passed to a template function
@ 2003-12-01 15:15 lev at cs dot technion dot ac dot il
  2003-12-01 15:17 ` [Bug c++/13259] " lev at cs dot technion dot ac dot il
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: lev at cs dot technion dot ac dot il @ 2003-12-01 15:15 UTC (permalink / raw)
  To: gcc-bugs

Bug happens (at least) on RedHat 7 (gcc 3.2.3) and cygwin (gcc 3.3.1)

Bug conditions (if relaxed, the bug disappears):
1. A class contains an initialized static const variable
2. There exists an external template function which may get this variable
   as a parameter
3. A class contains a virtual function that calls the template function
   above with static const as a parameter

Typical output: undefined reference to <var>; undefined reference to vtable.

-- 
           Summary: link fails, if static const is passed to a template
                    function
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: lev at cs dot technion dot ac dot il
                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=13259


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

* [Bug c++/13259] link fails, if static const is passed to a template function
  2003-12-01 15:15 [Bug c++/13259] New: link fails, if static const is passed to a template function lev at cs dot technion dot ac dot il
@ 2003-12-01 15:17 ` lev at cs dot technion dot ac dot il
  2003-12-01 15:28 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: lev at cs dot technion dot ac dot il @ 2003-12-01 15:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From lev at cs dot technion dot ac dot il  2003-12-01 15:17 -------
Created an attachment (id=5252)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5252&action=view)
A simple example (compile with gcc with no options)


-- 


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


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

* [Bug c++/13259] link fails, if static const is passed to a template function
  2003-12-01 15:15 [Bug c++/13259] New: link fails, if static const is passed to a template function lev at cs dot technion dot ac dot il
  2003-12-01 15:17 ` [Bug c++/13259] " lev at cs dot technion dot ac dot il
@ 2003-12-01 15:28 ` pinskia at gcc dot gnu dot org
  2003-12-01 15:49 ` lev at cs dot technion dot ac dot il
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-01 15:28 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-12-01 15:28 -------
The code is not valid as you still need to have declaration of T::N.

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


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


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

* [Bug c++/13259] link fails, if static const is passed to a template function
  2003-12-01 15:15 [Bug c++/13259] New: link fails, if static const is passed to a template function lev at cs dot technion dot ac dot il
  2003-12-01 15:17 ` [Bug c++/13259] " lev at cs dot technion dot ac dot il
  2003-12-01 15:28 ` pinskia at gcc dot gnu dot org
@ 2003-12-01 15:49 ` lev at cs dot technion dot ac dot il
  2003-12-01 15:56 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: lev at cs dot technion dot ac dot il @ 2003-12-01 15:49 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From lev at cs dot technion dot ac dot il  2003-12-01 15:49 -------
(In reply to comment #2)
> The code is not valid as you still need to have declaration of T::N.

ANSI C++ allows inline initialization of const static members without their 
declaration (at least this was the state in Draft of 1996).



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


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


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

* [Bug c++/13259] link fails, if static const is passed to a template function
  2003-12-01 15:15 [Bug c++/13259] New: link fails, if static const is passed to a template function lev at cs dot technion dot ac dot il
                   ` (2 preceding siblings ...)
  2003-12-01 15:49 ` lev at cs dot technion dot ac dot il
@ 2003-12-01 15:56 ` pinskia at gcc dot gnu dot org
  2003-12-01 16:09 ` bangerth at dealii dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-01 15:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-12-01 15:56 -------
But you taking a reference to it so GCC is not going to lay down another copy of it.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

* [Bug c++/13259] link fails, if static const is passed to a template function
  2003-12-01 15:15 [Bug c++/13259] New: link fails, if static const is passed to a template function lev at cs dot technion dot ac dot il
                   ` (3 preceding siblings ...)
  2003-12-01 15:56 ` pinskia at gcc dot gnu dot org
@ 2003-12-01 16:09 ` bangerth at dealii dot org
  2003-12-06  8:18 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: bangerth at dealii dot org @ 2003-12-01 16:09 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2003-12-01 16:09 -------
The standard says that you may inline-initialize the static variable,
but you still need to _define_ it somewhere so that a memory location
is assigned to it.

W.

-- 


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


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

* [Bug c++/13259] link fails, if static const is passed to a template function
  2003-12-01 15:15 [Bug c++/13259] New: link fails, if static const is passed to a template function lev at cs dot technion dot ac dot il
                   ` (4 preceding siblings ...)
  2003-12-01 16:09 ` bangerth at dealii dot org
@ 2003-12-06  8:18 ` pinskia at gcc dot gnu dot org
  2004-06-06  4:45 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-06  8:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-12-06 08:18 -------
*** Bug 13332 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gianni at mariani dot ws


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


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

* [Bug c++/13259] link fails, if static const is passed to a template function
  2003-12-01 15:15 [Bug c++/13259] New: link fails, if static const is passed to a template function lev at cs dot technion dot ac dot il
                   ` (5 preceding siblings ...)
  2003-12-06  8:18 ` pinskia at gcc dot gnu dot org
@ 2004-06-06  4:45 ` pinskia at gcc dot gnu dot org
  2004-09-26  4:39 ` pinskia at gcc dot gnu dot org
  2004-09-26  4:39 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-06  4:45 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-06 04:45 -------
*** 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=13259


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

* [Bug c++/13259] link fails, if static const is passed to a template function
  2003-12-01 15:15 [Bug c++/13259] New: link fails, if static const is passed to a template function lev at cs dot technion dot ac dot il
                   ` (7 preceding siblings ...)
  2004-09-26  4:39 ` pinskia at gcc dot gnu dot org
@ 2004-09-26  4:39 ` pinskia at gcc dot gnu dot org
  8 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 -------
Reopening to mark as ...

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


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


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

* [Bug c++/13259] link fails, if static const is passed to a template function
  2003-12-01 15:15 [Bug c++/13259] New: link fails, if static const is passed to a template function lev at cs dot technion dot ac dot il
                   ` (6 preceding siblings ...)
  2004-06-06  4:45 ` pinskia at gcc dot gnu dot org
@ 2004-09-26  4:39 ` pinskia at gcc dot gnu dot org
  2004-09-26  4:39 ` pinskia at gcc dot gnu dot org
  8 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 -------
a dup of bug 14404.

*** This bug has been marked as a duplicate of 14404 ***

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


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


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

end of thread, other threads:[~2004-09-26  4:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-01 15:15 [Bug c++/13259] New: link fails, if static const is passed to a template function lev at cs dot technion dot ac dot il
2003-12-01 15:17 ` [Bug c++/13259] " lev at cs dot technion dot ac dot il
2003-12-01 15:28 ` pinskia at gcc dot gnu dot org
2003-12-01 15:49 ` lev at cs dot technion dot ac dot il
2003-12-01 15:56 ` pinskia at gcc dot gnu dot org
2003-12-01 16:09 ` bangerth at dealii dot org
2003-12-06  8:18 ` pinskia at gcc dot gnu dot org
2004-06-06  4:45 ` pinskia at gcc dot gnu dot org
2004-09-26  4:39 ` pinskia at gcc dot gnu dot org
2004-09-26  4:39 ` 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).