From mboxrd@z Thu Jan 1 00:00:00 1970 From: whitley@bangpath.org To: gcc-gnats@gcc.gnu.org Subject: c++/3086: Suggested extension to a template related warning. Date: Fri, 08 Jun 2001 13:56:00 -0000 Message-id: <20010608204953.18303.qmail@sourceware.cygnus.com> X-SW-Source: 2001-06/msg00316.html List-Id: >Number: 3086 >Category: c++ >Synopsis: Suggested extension to a template related warning. >Confidential: no >Severity: non-critical >Priority: medium >Responsible: unassigned >State: open >Class: change-request >Submitter-Id: net >Arrival-Date: Fri Jun 08 13:56:01 PDT 2001 >Closed-Date: >Last-Modified: >Originator: John Whitley >Release: gcc version 2.95.4 20010604 (Debian prerelease) >Organization: >Environment: Current (as of about 7/7/2001) Debian unstable Linux i386 box >Description: This report also applies to the following gcc 3.0 version: 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-long-long --enable-nls --without-x --without-included-gettext --disable-checking --enable-threads=posix --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc i386-linux Thread model: posix gcc version 3.0 20010526 (Debian prerelease) A declaration such as "stack>" will correctly issue the warning: "`>>' should be `> >' in template class name" However, the attached sample code fails to emit this very helpful warning, instead producing a rather inscrutable error (for gcc 2.95.4 -- the warning differs slightly for gcc 3.0, but appears to have the same meaning.) The erroneous declaration (from line 37) is: Handle> handle(pd); Which produces the error message. param_templ2.cpp: In function `int main()': param_templ2.cpp:37: implicit declaration of function `int handle(...)' [...] Hopefully the attached file will be helpful in extending the above warning to cover more cases. Thanks for the great compilers! -- John Whitley >How-To-Repeat: g++ param_templ2.cpp >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: text/cpp; name="param_templ2.cpp" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="param_templ2.cpp" I2luY2x1ZGUgPHN0ZGlvLmg+Cgp0ZW1wbGF0ZSA8Y2xhc3MgVD4KY2xhc3MgSGFuZGxlCnsKcHVi bGljOgogIEhhbmRsZShUJiBfcmVmKSA6IHJlZihfcmVmKSB7fQoKICBpbnQgZ2V0WChpbnQgaSkg eyByZXR1cm4gcmVmLlhbaV07IH0KCiAgaW50IGdldFkoaW50IGkpIHsgcmV0dXJuIHJlZi5ZW2ld OyB9Cgpwcml2YXRlOgogIFQmIHJlZjsKfTsKCgp0ZW1wbGF0ZSA8aW50IE4+CmNsYXNzIE15UHJp dmF0ZURhdGEKewpwdWJsaWM6CiAgTXlQcml2YXRlRGF0YSgpIHsgZm9yIChpbnQgaSA9IDA7IGkg PCBOOyBpKyspIHsgWFtpXSA9IDQqKFlbaV0gPSBpKjIpOyB9IH0KICAKcHJpdmF0ZToKICB0ZW1w bGF0ZSA8Y2xhc3MgVD4gZnJpZW5kIGNsYXNzIEhhbmRsZTsKCiAgaW50IFhbTl07CiAgaW50IFlb Tl07Cn07CgppbnQgbWFpbigpCnsKICBzdGF0aWMgY29uc3QgaW50IEZPTyA9IDU7CgogIE15UHJp dmF0ZURhdGE8Rk9PPiBwZDsKCiAgSGFuZGxlPE15UHJpdmF0ZURhdGE8Rk9PPj4gaGFuZGxlKHBk KTsKCiAgZm9yIChpbnQgaSA9IDA7IGkgPCBGT087IGkrKykKICAgIHByaW50ZigiWFslZF0gaXMg JWQuICBZWyVkXSBpcyAlZC5cbiIsIGksIGhhbmRsZS5nZXRYKGkpLCBpLCBoYW5kbGUuZ2V0WShp KSk7Cgp9Cg==