On g++ versions 3.4.3, 3.4.4 and 4.0.0 the following code 
 
-------------------------------------------------------------------- 
#include <set> 
#include <vector> 
#include <utility> 
#include <exception> 
#include <string> 
#include <ostream> 
#include <stdexcept> 
 
namespace OKlib { 
  namespace TestSystem { 
    typedef unsigned int LineNumber; 
    class ErrorDescription { 
    public : 
      ErrorDescription() {} 
      ErrorDescription(const char* const file, const char* const line, const 
char* const type_test_class) {} 
      friend std::ostream& operator <<(std::ostream& out, const 
ErrorDescription& D) {} 
    }; 
    class TestException : public std::runtime_error { 
    public : 
      explicit TestException(const std::string& special_circumstances) : 
std::runtime_error(special_circumstances) {} 
      ~TestException() throw() {} 
      TestException& add(const ErrorDescription e) {} 
      friend std::ostream& operator <<(std::ostream& out, const TestException& 
E) {} 
    }; 
  } 
} 
 
namespace OKlib { 
  namespace TestSystem { 
    typedef double TestSingleParameter; 
    typedef std::vector<TestSingleParameter> TestParameter; 
    class TestBase { 
    protected : 
      void insert(TestBase* const p) const {} 
    public : 
      static int run_tests_default(std::ostream& out) {} 
      void perform_test(const TestParameter& P = TestParameter()) {} 
      TestBase() {} 
      virtual ~TestBase() {} 
   private : 
      virtual void perform_test_trivial() = 0; 
    };  
  } 
} 
 
namespace OKlib { 
  namespace SetAlgorithms { 
    template <typename InputIterator_sets, typename InputIterator_elements, 
typename OutputIterator> 
    struct Union { 
    public : 
      OutputIterator operator() (const InputIterator_sets begin, const 
InputIterator_sets end, OutputIterator out) const {} 
    }; 
  } 
} 
 
namespace OKlib { 
  namespace SetAlgorithms { 
    template <template <typename InputIterator_sets, typename 
InputIterator_elements, typename OutputIterator> class Union> 
    class Test_Union : public ::OKlib::TestSystem::TestBase { 
    private : 
      void perform_test_trivial() { 
          typedef int value_type; 
          typedef std::set<value_type> Set; 
          typedef Set::iterator set_iterator; 
          typedef std::pair<set_iterator, set_iterator> Range; 
          typedef std::vector<Range> VectorSets; 
          typedef VectorSets::iterator vector_iterator; 
          typedef std::vector<value_type> VectorValues; 
          typedef VectorValues::iterator value_iterator; 
          typedef Union<vector_iterator, set_iterator, value_iterator> 
union_type; 
          union_type union_f; 
          struct check_union : public ::OKlib::TestSystem::TestBase { 
            VectorSets& sets; 
            VectorValues& output; 
            Set& reference; 
            check_union(VectorSets& sets, VectorValues& output, Set& 
reference) : sets(sets), output(output), reference(reference) {} 
            void perform_test_trivial() { 
              const value_iterator end = union_f(sets.begin(), sets.end(), 
output.begin()); 
            } 
          }; 
          VectorSets sets; 
          VectorValues output; 
          Set reference; 
          check_union check(sets, output, reference); 
      } 
    }; 
  } 
} 
 
namespace OKlib { 
  namespace SetAlgorithms { 
      Test_Union<Union> test_union; 
  } 
} 
 
int main() {}  
------------------------------------------------------------------- 
 
produces 
 
> g++ Test_g++.cpp 
Test_g++.cpp: In member function ‘void 
OKlib::SetAlgorithms::Test_Union<Union>::perform_test_trivial()::check_union::perform_test_trivial()
 
[with Union = OKlib::SetAlgorithms::Union]’: 
Test_g++.cpp:78: internal compiler error: in make_decl_rtl, at varasm.c:868 
Please submit a full bug report, 
with preprocessed source if appropriate. 
See <URL:http://gcc.gnu.org/bugs.html> for instructions. 
 
To the best of my knowledge the code is syntactically correct (I removed 
all function bodies, so it won't do something sensible). 
 
Since I'm stuck now with my development, I would be glad if at least a  
workaround would be found. 
 
Oliver

-- 
           Summary: Internal compiler error on correct code
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: o dot kullmann at swansea dot ac dot uk
                CC: gcc-bugs at gcc dot gnu dot org


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

Reply via email to