public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "adele.schmidthammer at yahoo dot de" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/48883] New: ?: ternary operator fails in certain contexts - link error Date: Thu, 05 May 2011 11:46:00 -0000 [thread overview] Message-ID: <bug-48883-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48883 Summary: ?: ternary operator fails in certain contexts - link error Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: adele.schmidthammer@yahoo.de probably there is a relation to bug 48882 I do not attach the precompiled file (.ii), because it is too big. #include<algorithm> // std::max std::min #include<iostream> template<typename T> const T& myMin(const T& a, const T& b) { if(a < b) return a; return b; } template<typename T> const T& myMax(const T& a, const T& b) { if(a > b) return a; return b; } int main() { int a = 1000; int b = 2000; bool even = true; const int& (*fp)(const int&, const int&); fp = even ? myMax<int> : myMin<int>; /* yields link error */ std::cout << fp(a,b) << std::endl; } does not link. Output : Es werden eingebaute Spezifikationen verwendet. COLLECT_GCC=/home/me/programme/gcc47/bin/g++ COLLECT_LTO_WRAPPER=/home/me/programme/gcc47/libexec/gcc/i686-pc-linux-gnu/4.7.0/lto-wrapper Ziel: i686-pc-linux-gnu Konfiguriert mit: ./configure --prefix=/home/me/programme/gcc47 Thread-Modell: posix gcc-Version 4.7.0 20110430 (experimental) (GCC) COLLECT_GCC_OPTIONS='-v' '-std=c++0x' '-Wall' '-save-temps' '-shared-libgcc' '-mtune=generic' '-march=pentiumpro' /home/me/programme/gcc47/libexec/gcc/i686-pc-linux-gnu/4.7.0/cc1plus -E -quiet -v -D_GNU_SOURCE bug2.cpp -mtune=generic -march=pentiumpro -std=c++0x -Wall -fpch-preprocess -o bug2.ii nicht vorhandenes Verzeichnis »/home/me/programme/gcc47/lib/gcc/i686-pc-linux-gnu/4.7.0/../../../../i686-pc-linux-gnu/include« wird ignoriert #include "..." - Suche beginnt hier: #include <...> - Suche beginnt hier: /home/me/programme/gcc47/lib/gcc/i686-pc-linux-gnu/4.7.0/../../../../include/c++/4.7.0 /home/me/programme/gcc47/lib/gcc/i686-pc-linux-gnu/4.7.0/../../../../include/c++/4.7.0/i686-pc-linux-gnu /home/me/programme/gcc47/lib/gcc/i686-pc-linux-gnu/4.7.0/../../../../include/c++/4.7.0/backward /home/me/programme/gcc47/lib/gcc/i686-pc-linux-gnu/4.7.0/include /usr/local/include /home/me/programme/gcc47/include /home/me/programme/gcc47/lib/gcc/i686-pc-linux-gnu/4.7.0/include-fixed /usr/include Ende der Suchliste. COLLECT_GCC_OPTIONS='-v' '-std=c++0x' '-Wall' '-save-temps' '-shared-libgcc' '-mtune=generic' '-march=pentiumpro' /home/me/programme/gcc47/libexec/gcc/i686-pc-linux-gnu/4.7.0/cc1plus -fpreprocessed bug2.ii -quiet -dumpbase bug2.cpp -mtune=generic -march=pentiumpro -auxbase bug2 -Wall -std=c++0x -version -o bug2.s GNU C++ (GCC) Version 4.7.0 20110430 (experimental) (i686-pc-linux-gnu) kompiliert von GNU-C-Version 4.7.0 20110430 (experimental), GMP-Version 5.0.1, MPFR-Version 3.0.0-p3, MPC-Version 0.8.2. GGC-Heuristik: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 GNU C++ (GCC) Version 4.7.0 20110430 (experimental) (i686-pc-linux-gnu) kompiliert von GNU-C-Version 4.7.0 20110430 (experimental), GMP-Version 5.0.1, MPFR-Version 3.0.0-p3, MPC-Version 0.8.2. GGC-Heuristik: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Compiler executable checksum: c95befb475332395eb1695ad61c47f68 COLLECT_GCC_OPTIONS='-v' '-std=c++0x' '-Wall' '-save-temps' '-shared-libgcc' '-mtune=generic' '-march=pentiumpro' as --32 -o bug2.o bug2.s COMPILER_PATH=/home/me/programme/gcc47/libexec/gcc/i686-pc-linux-gnu/4.7.0/:/home/me/programme/gcc47/libexec/gcc/i686-pc-linux-gnu/4.7.0/:/home/me/programme/gcc47/libexec/gcc/i686-pc-linux-gnu/:/home/me/programme/gcc47/lib/gcc/i686-pc-linux-gnu/4.7.0/:/home/me/programme/gcc47/lib/gcc/i686-pc-linux-gnu/ LIBRARY_PATH=/home/me/programme/gcc47/lib/gcc/i686-pc-linux-gnu/4.7.0/:/home/me/programme/gcc47/lib/gcc/i686-pc-linux-gnu/4.7.0/../../../:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS='-v' '-std=c++0x' '-Wall' '-save-temps' '-shared-libgcc' '-mtune=generic' '-march=pentiumpro' /home/me/programme/gcc47/libexec/gcc/i686-pc-linux-gnu/4.7.0/collect2 --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 /usr/lib/crt1.o /usr/lib/crti.o /home/me/programme/gcc47/lib/gcc/i686-pc-linux-gnu/4.7.0/crtbegin.o -L/home/me/programme/gcc47/lib/gcc/i686-pc-linux-gnu/4.7.0 -L/home/me/programme/gcc47/lib/gcc/i686-pc-linux-gnu/4.7.0/../../.. bug2.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /home/me/programme/gcc47/lib/gcc/i686-pc-linux-gnu/4.7.0/crtend.o /usr/lib/crtn.o bug2.o: In function `main': bug2.cpp:(.text+0x26): undefined reference to `int const& myMax<int>(int const&, int const&)' bug2.cpp:(.text+0x2d): undefined reference to `int const& myMin<int>(int const&, int const&)' collect2: ld gab 1 als Ende-Status zurück
next reply other threads:[~2011-05-05 11:46 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-05-05 11:46 adele.schmidthammer at yahoo dot de [this message] 2011-05-05 12:02 ` [Bug c++/48883] " adele.schmidthammer at yahoo dot de 2011-05-05 12:15 ` redi at gcc dot gnu.org 2011-07-01 16:43 ` jason at gcc dot gnu.org 2011-07-01 16:51 ` redi at gcc dot gnu.org 2011-07-01 17:56 ` jason at gcc dot gnu.org 2011-07-01 20:26 ` jason at gcc dot gnu.org 2011-07-01 20:53 ` jason at gcc dot gnu.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-48883-4@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).