public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "onay at ee dot bilkent dot edu dot tr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/42338]  New: [c++0x] ICE on decltype usage with templates
Date: Tue, 08 Dec 2009 23:37:00 -0000	[thread overview]
Message-ID: <bug-42338-18541@http.gcc.gnu.org/bugzilla/> (raw)

The following code causes an ICE with segmentation fault:
----------------------------------------------------------------------
#include <iostream>
#include <vector>

template< typename T1 >
void vadd(const std::vector< T1 > &a, decltype(a[0]) t) {
    std::cout << "-> ICE \n";
}
void vadd(const std::vector< int > &a, decltype(a[0]) t) {
    std::cout << " compiles \n";
}


int main() {
    std::vector< int > a;
    std::vector< float > b;
    int c;
    vadd(b,c); // leads to ICE
//     vadd(a,c); // compiles
}
----------------------------------------------------------------------
Output of 
"g++ -v -save-temps   gcc-error-src.cpp -o gcc-error -std=c++0x"
yields:

Using built-in specs.                                                           
Target: x86_64-linux-gnu                                                        
Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.2-3'
--with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
--enable-multiarch --enable-linker-build-id --with-system-zlib
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls
--enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc
--with-arch-32=i486 --with-tune=generic --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu      
Thread model: posix                                                             
gcc version 4.4.2 (Debian 4.4.2-3)                                              
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-o' 'gcc-error' '-std=c++0x'
'-shared-libgcc' '-mtune=generic'                                               
 /usr/lib/gcc/x86_64-linux-gnu/4.4.2/cc1plus -E -quiet -v -D_GNU_SOURCE
gcc-error-src.cpp -mtune=generic -std=c++0x -fpch-preprocess -o
gcc-error-src.ii                                                                
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"            
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-linux-gnu/4.4.2/../../../../x86_64-linux-gnu/include"      
ignoring nonexistent directory "/usr/include/x86_64-linux-gnu"                  
#include "..." search starts here:                                              
#include <...> search starts here:                                              
 /usr/include/c++/4.4                                                           
 /usr/include/c++/4.4/x86_64-linux-gnu                                          
 /usr/include/c++/4.4/backward                                                  
 /usr/local/include                                                             
 /usr/lib/gcc/x86_64-linux-gnu/4.4.2/include                                    
 /usr/lib/gcc/x86_64-linux-gnu/4.4.2/include-fixed                              
 /usr/include                                                                   
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-o' 'gcc-error' '-std=c++0x'
'-shared-libgcc' '-mtune=generic'
 /usr/lib/gcc/x86_64-linux-gnu/4.4.2/cc1plus -fpreprocessed gcc-error-src.ii
-quiet -dumpbase gcc-error-src.cpp -mtune=generic -auxbase gcc-error-src
-std=c++0x -version -o gcc-error-src.s
GNU C++ (Debian 4.4.2-3) version 4.4.2 (x86_64-linux-gnu)
        compiled by GNU C version 4.4.2, GMP version 4.3.1, MPFR version
2.4.1-p2.
warning: MPFR header version 2.4.1-p2 differs from library version 2.4.2.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 76c61736f716d7c937923f7eb86174cd
gcc-error-src.cpp:19: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.4/README.Bugs> for instructions.


-- 
           Summary: [c++0x] ICE on decltype usage with templates
           Product: gcc
           Version: 4.4.2
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: onay at ee dot bilkent dot edu dot tr


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42338


             reply	other threads:[~2009-12-08 23:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-08 23:37 onay at ee dot bilkent dot edu dot tr [this message]
2009-12-09  9:50 ` [Bug c++/42338] " paolo dot carlini at oracle dot com
2009-12-18  0:42 ` redi at gcc dot gnu dot org
2010-01-20 22:42 ` jason at gcc dot gnu dot org
2010-01-21  1:59 ` jason at gcc dot gnu dot org
2010-01-21 10:17 ` paolo dot carlini at oracle dot com
2010-02-09 22:31 ` jason 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-42338-18541@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: link
Be 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).