public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13915] New: Initialization of static template members
@ 2004-01-29 4:08 japple at freeshell dot org
2004-01-29 4:16 ` [Bug c++/13915] " pinskia at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: japple at freeshell dot org @ 2004-01-29 4:08 UTC (permalink / raw)
To: gcc-bugs
#include <iostream>
template<typename T>
struct wrap {
static T joe;
};
template<typename T>
T wrap<T>::joe;
struct call_out {
int num;
call_out() : num(77) {}
};
template<typename T>
struct check_call {
check_call() {
std::cout << wrap<T>::joe.num << std::endl;
}
};
check_call<call_out> x;
int main(){}
should print 77, I think, by 14.7.1/1, which says says:
"... in particular, the initialization (and any associated side effects)
of a static data member does not occur unless the static data member is
itself used in a way that requires the definition of the static data
member to exist."
--
Summary: Initialization of static template members
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: japple at freeshell dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: linux x86
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13915
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/13915] Initialization of static template members
2004-01-29 4:08 [Bug c++/13915] New: Initialization of static template members japple at freeshell dot org
@ 2004-01-29 4:16 ` pinskia at gcc dot gnu dot org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-29 4:16 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-01-29 04:16 -------
This is a dup of bug 10112. The problem is that order is undefined.
*** This bug has been marked as a duplicate of 10112 ***
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13915
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-01-29 4:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-29 4:08 [Bug c++/13915] New: Initialization of static template members japple at freeshell dot org
2004-01-29 4:16 ` [Bug c++/13915] " 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).