public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: "Robert B. Lowrie" <lowrie@belle.lanl.gov> To: gcc-gnats@gcc.gnu.org Cc: furboo@cybermesa.com Subject: c++/3012: c++ bug Date: Thu, 31 May 2001 08:26:00 -0000 [thread overview] Message-ID: <200105311522.f4VFMMJ28208@belle.lanl.gov> (raw) >Number: 3012 >Category: c++ >Synopsis: templated member function fails within templated class >Confidential: no >Severity: critical >Priority: high >Responsible: unassigned >State: open >Class: rejects-legal >Submitter-Id: net >Arrival-Date: Thu May 31 08:26:01 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Robert B. Lowrie >Release: 3.0 20010528 (prerelease) >Organization: >Environment: System: Linux belle 2.4.2-2 #1 Sun Apr 8 20:41:30 EDT 2001 i686 unknown Architecture: i686 host: i686-pc-linux-gnu build: i686-pc-linux-gnu target: i686-pc-linux-gnu configured with: ../gcc-20010528/configure --prefix=/usr/local/gcc-20010528 >Description: If a templated member function `foo' of even a non-templated class `A' is called within a templated class `B' with the syntax foo<double>(), the compiler gives a syntax error. >How-To-Repeat: // Here is a code snippet that repeats the problem: #include <iostream> // Defining B_IS_A_TEMPLATE makes class B a template and this code fails // to compile. If not defined (comment next line out), the code compiles // and runs successfully. #define B_IS_A_TEMPLATE class A { public: template <class T> void foo() const { T data; std::cout << data << std::endl; } }; #ifdef B_IS_A_TEMPLATE template <class T> #endif class B { public: void bar(const A& a) const { // when B is a template, compile fails on this line: a.foo<double>(); } }; int main() { A a; #ifdef B_IS_A_TEMPLATE B<int> b; #else B b; #endif b.bar(a); } >Fix: >Release-Note: >Audit-Trail: >Unformatted:
next reply other threads:[~2001-05-31 8:26 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2001-05-31 8:26 Robert B. Lowrie [this message] 2001-06-01 3:46 Artem Khodush 2001-06-01 18:26 Gabriel Dos Reis
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=200105311522.f4VFMMJ28208@belle.lanl.gov \ --to=lowrie@belle.lanl.gov \ --cc=furboo@cybermesa.com \ --cc=gcc-gnats@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).