https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71747

            Bug ID: 71747
           Summary: ICE on invalid C++11 code with misuse of overloaded
                    operator '()': Segmentation fault (program cc1plus)
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu
  Target Milestone: ---

The following C++11 code causes an ICE (without any proper error diagnostics
before the ICE) when compiled with the current GCC trunk on x86_64-linux-gnu in
both 32-bit and 64-bit modes.  

It also affects all versions since at least as early as 4.6.x. 


$ g++-trunk -v
Using built-in specs.
COLLECT_GCC=g++-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160703 (experimental) [trunk revision 237949] (GCC) 
$ 
$ g++-trunk -c -std=c++11 small.cpp
g++-trunk: internal compiler error: Segmentation fault (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ 


---------------------------------------------------------------------


template < bool > struct A
{
  typedef int type; 
  constexpr bool operator() () const 
  { 
    return true; 
  }
}; 

template < bool, typename = int > struct F; 
template < bool X > 
// should be: struct F < X, typename A < A < X > {} () >::type > 
struct F < X, typename A < F < X > {} () >::type > 
{
};

F < true > f;

Reply via email to