public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/3976: g++ 3.0 has problems with static const int as templated argument
@ 2001-08-10 13:11 aoliva
  0 siblings, 0 replies; 2+ messages in thread
From: aoliva @ 2001-08-10 13:11 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, karen.cooper, lakshman, nobody

Synopsis: g++ 3.0 has problems with static const int as templated argument

State-Changed-From-To: open->closed
State-Changed-By: aoliva
State-Changed-When: Fri Aug 10 13:11:55 2001
State-Changed-Why:
    Not a bug.  Every static data member must be defined outside the class body if it is referenced in the program, even if it is a const data member initialized with a constant expression inside the class body.  In this case, the definition outside the class body must not contain an initializer.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3976&database=gcc


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

* c++/3976: g++ 3.0 has problems with static const int as templated argument
@ 2001-08-09 11:56 lakshman
  0 siblings, 0 replies; 2+ messages in thread
From: lakshman @ 2001-08-09 11:56 UTC (permalink / raw)
  To: gcc-gnats; +Cc: karen.cooper

>Number:         3976
>Category:       c++
>Synopsis:       g++ 3.0 has problems with static const int as templated argument
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Aug 09 11:56:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     V Lakshmanan
>Release:        g++ 3.0 (seen also on current CVS version)
>Organization:
>Environment:
Reading specs from /usr/lib/gcc-lib/i386-linux/3.0/specs
Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,objc --prefix=/usr --infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib --enable-threads=posix --enable-long-long --enable-nls --without-x --without-included-gettext --disable-checking --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc i386-linux
gcc version 3.0 20010402 (Debian prerelease)


Seen also on current CVS version of g++-3.0 on Solaris
>Description:
When a static const int is used as a parameter to
any method that takes a template argument, we
get an undefined reference error when linking.

g++-2.95 handles this with no problems.
>How-To-Repeat:
uncomment line 36 or 41
>Fix:
don't know.

Workaround shown in lines 37&38, i.e. make copy of
static const int and then pass copy into method.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="test.cc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="test.cc"

Cgp0ZW1wbGF0ZTxjbGFzcyBUPgpjbGFzcyBBCnsKcHVibGljOgogIEEoY29uc3QgVCYgaW4pOiBh
KGluKQogIHsKICB9CiAgdm9pZCBkb1NvbWV0aGluZygpCiAgewogICAgYSsrOwogIH0KICB2b2lk
IHNldFZhbChjb25zdCBUJiBpbikgCiAgewogICAgYSA9IGluOwogIH0KICAKcHJpdmF0ZToKICBU
IGE7Cn0KOwoKY2xhc3MgQgp7CnB1YmxpYzoKICBzdGF0aWMgY29uc3QgaW50IEMgPSAtMTsgLy8g
c3RhdGljIGNvbnN0IHRoYXQgaXMgInVuZGVmaW5lZCIKICAKICB2b2lkIGRvU29tZXRoaW5nKCk7
Cn0KOwoKdm9pZCBCOjpkb1NvbWV0aGluZygpCnsKICAvLyB1bmNvbW1lbnQgdGhpcyBsaW5lIHRv
IHNlZSB1bmRlZmluZWQgcmVmZXJlbmNlIHByb2JsZW0KICAvL0E8aW50PiBteUIoQyk7IC8vIHRo
ZSBzdGF0aWMgY29uc3QgY2F1c2VzIHByb2JsZW1zCiAgaW50IHdvcmtfYXJvdW5kID0gQzsKICBB
PGludD4gbXlBKHdvcmtfYXJvdW5kKTsgLy8gbm8gcHJvYmxlbQogIG15QS5kb1NvbWV0aGluZygp
OwogIC8vIHRoaXMgYWxzbyBjYXVzZXMgcHJvYmxlbQogIC8vbXlBLnNldFZhbChDKTsKfQoKaW50
IG1haW4oKQp7CiAgQiBoYTsKICBoYS5kb1NvbWV0aGluZygpOwp9CgogIAo=


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

end of thread, other threads:[~2001-08-10 13:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-10 13:11 c++/3976: g++ 3.0 has problems with static const int as templated argument aoliva
  -- strict thread matches above, loose matches on Subject: below --
2001-08-09 11:56 lakshman

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