public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "samuel dot hangouet at free dot fr" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/29942] New: Template parameter refused as a template parameter. Date: Wed, 22 Nov 2006 15:13:00 -0000 [thread overview] Message-ID: <bug-29942-13605@http.gcc.gnu.org/bugzilla/> (raw) [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 3273 bytes --] The following code produce a compilation error at the unique line of the function named "visit" below (it is a basic implementation of a visitor pattern) : # 1 "test.cpp" # 1 "<interne>" # 1 "<ligne de commande>" # 1 "test.cpp" template <typename T> struct Toto { template <typename T2> void visit(T2 * o) { o->eval<T>(); } }; template <typename T> struct Titi { template <typename T2> void eval() { } }; int main() { Toto<int> toto; Titi<int> titi; toto.visit(& titi); return 0; } g++ test.cpp -o test test.cpp: In member function «void Toto<T>::visit(T2*)»: test.cpp:7: erreur: expected primary-expression before «>» token test.cpp:7: erreur: expected primary-expression before «)» token make: *** [test] Erreur 1 I tried this with g++-3.4.6 too (it compiles and run well with msvc 8.0). Here is the output of the command "g++ -v -save-temps test.cpp" : Utilisation des specs internes. Cible : i486-linux-gnu Configuré avec: ../src/configure -v --enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.0 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-java-awt=gtk-default --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre --enable-mpfr --disable-werror --with-tune=pentium4 --enable-checking=release i486-linux-gnu Modèle de thread: posix version gcc 4.0.3 (Ubuntu 4.0.3-1ubuntu5) /usr/lib/gcc/i486-linux-gnu/4.0.3/cc1plus -E -quiet -v -D_GNU_SOURCE test.cpp -mtune=pentium4 -fpch-preprocess -o test.ii le répertoire « /usr/local/include/i486-linux-gnu » est ignoré car inexistant le répertoire « /usr/include/i486-linux-gnu » est ignoré car inexistant la recherche pour #include "..." débute ici : la recherche pour #include <...> débute ici: /usr/lib/gcc/i486-linux-gnu/4.0.3/../../../../include/c++/4.0.3 /usr/lib/gcc/i486-linux-gnu/4.0.3/../../../../include/c++/4.0.3/i486-linux-gnu /usr/lib/gcc/i486-linux-gnu/4.0.3/../../../../include/c++/4.0.3/backward /usr/local/include /usr/lib/gcc/i486-linux-gnu/4.0.3/include /usr/include Fin de la liste de recherche. /usr/lib/gcc/i486-linux-gnu/4.0.3/cc1plus -fpreprocessed test.ii -quiet -dumpbase test.cpp -mtune=pentium4 -auxbase test -version -o test.s GNU C++ version 4.0.3 (Ubuntu 4.0.3-1ubuntu5) (i486-linux-gnu) compiled by GNU C version 4.0.3 (Ubuntu 4.0.3-1ubuntu5). heuristiques GGC: --param ggc-min-expand=64 --param ggc-min-heapsize=64420 test.cpp: In member function «void Toto<T>::visit(T2*)»: test.cpp:7: erreur: expected primary-expression before «>» token test.cpp:7: erreur: expected primary-expression before «)» token -- Summary: Template parameter refused as a template parameter. Product: gcc Version: 4.0.3 Status: UNCONFIRMED Severity: major Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: samuel dot hangouet at free dot fr GCC host triplet: Ubuntu 4.0.3-1ubuntu5 GCC target triplet: i486-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29942
next reply other threads:[~2006-11-22 15:13 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2006-11-22 15:13 samuel dot hangouet at free dot fr [this message] 2006-11-22 16:47 ` [Bug c++/29942] " pinskia at gcc dot gnu dot org
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=bug-29942-13605@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@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).