c++/3976: g++ 3.0 has problems with static const int as templated argument

lakshman@nssl.noaa.gov lakshman@nssl.noaa.gov
Thu Aug 9 11:56:00 GMT 2001


>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=



More information about the Gcc-prs mailing list