cat has_construct.cc && g++-trunk -v -std=c++0x has_construct.cc
#include <type_traits>

template<typename T1, typename T2, typename... Args>
struct has_construct
{
    typedef char one;
    typedef struct {char _m[2]; } two;

    template<typename U1, typename U2, typename... Args2>
    static decltype(std::declval<U1>().construct(std::declval<U2*>(),
std::declval<Args2>()...), one()) test(int);
    template<typename, typename, typename...>
    static two test(...);

    static const bool value = sizeof(test<T1, T2, Args...>(0)) == 1;
};


class A0
{};

class A1
{
    void construct(int*, int);
};

template<typename _Tp>
struct A2
{
  template<typename _Tp1, typename... _Args>
  void construct(_Tp1*, _Args&&...) {}
};


void foo()
{
    static bool a0 = has_construct<A0, int, int>::value; // ok
    static bool a1 = has_construct<A1, int, int>::value; // bang
    static bool a2 = has_construct<A2<int>, int>::value; // bang
}

Using built-in specs.
COLLECT_GCC=/home/prak/Dev/gcc-install/bin/g++-trunk
COLLECT_LTO_WRAPPER=/home/prak/Dev/gcc-install/libexec/gcc/i686-pc-linux-gnu/4.6.0/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ../gcc.git/configure --enable-languages=c,c++
--program-suffix=-trunk --prefix=/home/prak/Dev/gcc-install --disable-bootstrap
Thread model: posix
gcc version 4.6.0 20100716 (experimental) (GCC) 
COLLECT_GCC_OPTIONS='-v' '-std=c++0x' '-shared-libgcc' '-mtune=generic'
'-march=pentiumpro'
 /home/prak/Dev/gcc-install/libexec/gcc/i686-pc-linux-gnu/4.6.0/cc1plus -quiet
-v -D_GNU_SOURCE has_construct.cc -quiet -dumpbase has_construct.cc
-mtune=generic -march=pentiumpro -auxbase has_construct -std=c++0x -version -o
/tmp/ccY4xmeE.s
GNU C++ (GCC) version 4.6.0 20100716 (experimental) (i686-pc-linux-gnu)
        compiled by GNU C version 4.3.4, GMP version 4.3.2, MPFR version 3.0.0,
MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory
"/home/prak/Dev/gcc-install/lib/gcc/i686-pc-linux-gnu/4.6.0/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:

/home/prak/Dev/gcc-install/lib/gcc/i686-pc-linux-gnu/4.6.0/../../../../include/c++/4.6.0

/home/prak/Dev/gcc-install/lib/gcc/i686-pc-linux-gnu/4.6.0/../../../../include/c++/4.6.0/i686-pc-linux-gnu

/home/prak/Dev/gcc-install/lib/gcc/i686-pc-linux-gnu/4.6.0/../../../../include/c++/4.6.0/backward
 /home/prak/Dev/gcc-install/include
 /home/prak/Dev/gcc-install/lib/gcc/i686-pc-linux-gnu/4.6.0/include
 /home/prak/Dev/gcc-install/lib/gcc/i686-pc-linux-gnu/4.6.0/include-fixed
 /usr/include
End of search list.
GNU C++ (GCC) version 4.6.0 20100716 (experimental) (i686-pc-linux-gnu)
        compiled by GNU C version 4.3.4, GMP version 4.3.2, MPFR version 3.0.0,
MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 6d1c47967936e3e68fa845533411d5d9
has_construct.cc: In instantiation of &#8216;const bool has_construct<A1, int,
int>::value&#8217;:
has_construct.cc:37:51:   instantiated from here
has_construct.cc:14:67: internal compiler error: Naruszenie ochrony pamiêci
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

Same with released 4.5.0


-- 
           Summary: [C++0x] decltype of method call dependand on pack
                    expansion crashes
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: piotr dot rak at gmail dot com


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

Reply via email to