COIN-OR::LEMON - Graph Library

Opened 8 years ago

Closed 8 years ago

#354 closed defect (fixed)

min_cost_flow_test.cc fails to compile with gcc-3.3

Reported by: alpar Owned by: kpeter
Priority: blocker Milestone: LEMON 1.2 release
Component: build system Version: hg main
Keywords: b6f76c95992e Cc:
Revision id:

Description

Please find the compiler output below.

depbase=`echo test/min_cost_flow_test.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
	g++-3.3 -DHAVE_CONFIG_H   -I.. -I.  -Wall -W -Wall -W -Wunused -Wformat=2 -Wctor-dtor-privacy -Wnon-virtual-dtor -Wno-char-subscripts -Wwrite-strings -Wno-char-subscripts -Wreturn-type -Wcast-qual -Wcast-align -Wsign-promo -Woverloaded-virtual -ansi -fno-strict-aliasing -Wold-style-cast -Wno-unknown-pragmas -ggdb -Werror -MT test/min_cost_flow_test.o -MD -MP -MF $depbase.Tpo -c -o test/min_cost_flow_test.o ../test/min_cost_flow_test.cc &&\
	mv -f $depbase.Tpo $depbase.Po
../lemon/capacity_scaling.h: In instantiation of `lemon::CapacityScaling<main()::GR, int, int, lemon::CapacityScalingDefaultTraits<main()::GR, int, int> >::SetHeap<lemon::concepts::Heap<int, lemon::RangeMap<int>, std::less<int> > >':
../test/min_cost_flow_test.cc:474:   instantiated from here
../lemon/capacity_scaling.h:298: error: base `
   lemon::CapacityScaling<main()::GR, int, int, 
   lemon::CapacityScaling<main()::GR, int, int, 
   lemon::CapacityScalingDefaultTraits<main()::GR, int, int> 
   >::SetHeapTraits<lemon::concepts::Heap<int, lemon::RangeMap<int>, 
   std::less<int> > > >' with only non-default constructor in class without a 
   constructor
../lemon/cost_scaling.h: In instantiation of `lemon::CostScaling<main()::GR, int, int, lemon::CostScalingDefaultTraits<main()::GR, int, int, true> >::SetLargeCost<double>':
../test/min_cost_flow_test.cc:488:   instantiated from here
../lemon/cost_scaling.h:322: error: base `lemon::CostScaling<main()::GR, int, 
   int, lemon::CostScaling<main()::GR, int, int, 
   lemon::CostScalingDefaultTraits<main()::GR, int, int, true> 
   >::SetLargeCostTraits<double> >' with only non-default constructor in class 
   without a constructor
../lemon/howard.h: In instantiation of `lemon::Howard<lemon::StaticDigraph, lemon::CycleCanceling<main()::GR, int, int>::StaticVectorMap<lemon::StaticDigraphBase::Arc, int>, lemon::HowardDefaultTraits<lemon::StaticDigraph, lemon::CycleCanceling<main()::GR, int, int>::StaticVectorMap<lemon::StaticDigraphBase::Arc, int>, true> >::SetPath<lemon::SimplePath<lemon::StaticDigraph> >':
../lemon/cycle_canceling.h:928:   instantiated from `void lemon::CycleCanceling<GR, V, C>::startMinMeanCycleCanceling() [with GR = main()::GR, V = int, C = int]'
../lemon/cycle_canceling.h:801:   instantiated from `void lemon::CycleCanceling<GR, V, C>::start(lemon::CycleCanceling<GR, V, C>::Method) [with GR = main()::GR, V = int, C = int]'
../lemon/cycle_canceling.h:414:   instantiated from `lemon::CycleCanceling<GR, V, C>::ProblemType lemon::CycleCanceling<GR, V, C>::run(lemon::CycleCanceling<GR, V, C>::Method) [with GR = main()::GR, V = int, C = int]'
../test/min_cost_flow_test.cc:160:   instantiated from `void McfClassConcept<GR, Value, Cost>::Constraints<MCF>::constraints() [with MCF = lemon::CycleCanceling<main()::GR, int, int>, GR = main()::GR, Value = int, Cost = int]'
../lemon/concept_check.h:54:   instantiated from `void lemon::checkConcept() [with Concept = McfClassConcept<main()::GR, int, int>, Type = lemon::CycleCanceling<main()::GR, int, int>]'
../test/min_cost_flow_test.cc:496:   instantiated from here
../lemon/howard.h:228: error: base `lemon::Howard<lemon::StaticDigraph, 
   lemon::CycleCanceling<main()::GR, int, 
   int>::StaticVectorMap<lemon::StaticDigraphBase::Arc, int>, 
   lemon::Howard<lemon::StaticDigraph, lemon::CycleCanceling<main()::GR, int, 
   int>::StaticVectorMap<lemon::StaticDigraphBase::Arc, int>, 
   lemon::HowardDefaultTraits<lemon::StaticDigraph, 
   lemon::CycleCanceling<main()::GR, int, 
   int>::StaticVectorMap<lemon::StaticDigraphBase::Arc, int>, true> 
   >::SetPathTraits<lemon::SimplePath<lemon::StaticDigraph> > >' with only 
   non-default constructor in class without a constructor
../lemon/howard.h: In instantiation of `lemon::Howard<lemon::StaticDigraph, lemon::CycleCanceling<main()::GR, double, double>::StaticVectorMap<lemon::StaticDigraphBase::Arc, double>, lemon::HowardDefaultTraits<lemon::StaticDigraph, lemon::CycleCanceling<main()::GR, double, double>::StaticVectorMap<lemon::StaticDigraphBase::Arc, double>, false> >::SetPath<lemon::SimplePath<lemon::StaticDigraph> >':
../lemon/cycle_canceling.h:928:   instantiated from `void lemon::CycleCanceling<GR, V, C>::startMinMeanCycleCanceling() [with GR = main()::GR, V = double, C = double]'
../lemon/cycle_canceling.h:801:   instantiated from `void lemon::CycleCanceling<GR, V, C>::start(lemon::CycleCanceling<GR, V, C>::Method) [with GR = main()::GR, V = double, C = double]'
../lemon/cycle_canceling.h:414:   instantiated from `lemon::CycleCanceling<GR, V, C>::ProblemType lemon::CycleCanceling<GR, V, C>::run(lemon::CycleCanceling<GR, V, C>::Method) [with GR = main()::GR, V = double, C = double]'
../test/min_cost_flow_test.cc:160:   instantiated from `void McfClassConcept<GR, Value, Cost>::Constraints<MCF>::constraints() [with MCF = lemon::CycleCanceling<main()::GR, double, double>, GR = main()::GR, Value = double, Cost = double]'
../lemon/concept_check.h:54:   instantiated from `void lemon::checkConcept() [with Concept = McfClassConcept<main()::GR, double, double>, Type = lemon::CycleCanceling<main()::GR, double, double>]'
../test/min_cost_flow_test.cc:498:   instantiated from here
../lemon/howard.h:228: error: base `lemon::Howard<lemon::StaticDigraph, 
   lemon::CycleCanceling<main()::GR, double, 
   double>::StaticVectorMap<lemon::StaticDigraphBase::Arc, double>, 
   lemon::Howard<lemon::StaticDigraph, lemon::CycleCanceling<main()::GR, 
   double, double>::StaticVectorMap<lemon::StaticDigraphBase::Arc, double>, 
   lemon::HowardDefaultTraits<lemon::StaticDigraph, 
   lemon::CycleCanceling<main()::GR, double, 
   double>::StaticVectorMap<lemon::StaticDigraphBase::Arc, double>, false> 
   >::SetPathTraits<lemon::SimplePath<lemon::StaticDigraph> > >' with only 
   non-default constructor in class without a constructor
../lemon/howard.h: In instantiation of `lemon::Howard<lemon::StaticDigraph, lemon::CycleCanceling<main()::GR, int, double>::StaticVectorMap<lemon::StaticDigraphBase::Arc, double>, lemon::HowardDefaultTraits<lemon::StaticDigraph, lemon::CycleCanceling<main()::GR, int, double>::StaticVectorMap<lemon::StaticDigraphBase::Arc, double>, false> >::SetPath<lemon::SimplePath<lemon::StaticDigraph> >':
../lemon/cycle_canceling.h:928:   instantiated from `void lemon::CycleCanceling<GR, V, C>::startMinMeanCycleCanceling() [with GR = main()::GR, V = int, C = double]'
../lemon/cycle_canceling.h:801:   instantiated from `void lemon::CycleCanceling<GR, V, C>::start(lemon::CycleCanceling<GR, V, C>::Method) [with GR = main()::GR, V = int, C = double]'
../lemon/cycle_canceling.h:414:   instantiated from `lemon::CycleCanceling<GR, V, C>::ProblemType lemon::CycleCanceling<GR, V, C>::run(lemon::CycleCanceling<GR, V, C>::Method) [with GR = main()::GR, V = int, C = double]'
../test/min_cost_flow_test.cc:160:   instantiated from `void McfClassConcept<GR, Value, Cost>::Constraints<MCF>::constraints() [with MCF = lemon::CycleCanceling<main()::GR, int, double>, GR = main()::GR, Value = int, Cost = double]'
../lemon/concept_check.h:54:   instantiated from `void lemon::checkConcept() [with Concept = McfClassConcept<main()::GR, int, double>, Type = lemon::CycleCanceling<main()::GR, int, double>]'
../test/min_cost_flow_test.cc:500:   instantiated from here
../lemon/howard.h:228: error: base `lemon::Howard<lemon::StaticDigraph, 
   lemon::CycleCanceling<main()::GR, int, 
   double>::StaticVectorMap<lemon::StaticDigraphBase::Arc, double>, 
   lemon::Howard<lemon::StaticDigraph, lemon::CycleCanceling<main()::GR, int, 
   double>::StaticVectorMap<lemon::StaticDigraphBase::Arc, double>, 
   lemon::HowardDefaultTraits<lemon::StaticDigraph, 
   lemon::CycleCanceling<main()::GR, int, 
   double>::StaticVectorMap<lemon::StaticDigraphBase::Arc, double>, false> 
   >::SetPathTraits<lemon::SimplePath<lemon::StaticDigraph> > >' with only 
   non-default constructor in class without a constructor
../lemon/howard.h: In instantiation of `lemon::Howard<lemon::StaticDigraph, lemon::CycleCanceling<Digraph, int, int>::StaticVectorMap<lemon::StaticDigraphBase::Arc, int>, lemon::HowardDefaultTraits<lemon::StaticDigraph, lemon::CycleCanceling<Digraph, int, int>::StaticVectorMap<lemon::StaticDigraphBase::Arc, int>, true> >::SetPath<lemon::SimplePath<lemon::StaticDigraph> >':
../lemon/cycle_canceling.h:928:   instantiated from `void lemon::CycleCanceling<GR, V, C>::startMinMeanCycleCanceling() [with GR = Digraph, V = int, C = int]'
../lemon/cycle_canceling.h:801:   instantiated from `void lemon::CycleCanceling<GR, V, C>::start(lemon::CycleCanceling<GR, V, C>::Method) [with GR = Digraph, V = int, C = int]'
../lemon/cycle_canceling.h:414:   instantiated from `lemon::CycleCanceling<GR, V, C>::ProblemType lemon::CycleCanceling<GR, V, C>::run(lemon::CycleCanceling<GR, V, C>::Method) [with GR = Digraph, V = int, C = int]'
../test/min_cost_flow_test.cc:338:   instantiated from `void runMcfGeqTests(Param, const std::string&, bool) [with MCF = main()::MCF, Param = lemon::CycleCanceling<Digraph, int, int>::Method]'
../test/min_cost_flow_test.cc:536:   instantiated from here
../lemon/howard.h:228: error: base `lemon::Howard<lemon::StaticDigraph, 
   lemon::CycleCanceling<Digraph, int, 
   int>::StaticVectorMap<lemon::StaticDigraphBase::Arc, int>, 
   lemon::Howard<lemon::StaticDigraph, lemon::CycleCanceling<Digraph, int, 
   int>::StaticVectorMap<lemon::StaticDigraphBase::Arc, int>, 
   lemon::HowardDefaultTraits<lemon::StaticDigraph, 
   lemon::CycleCanceling<Digraph, int, 
   int>::StaticVectorMap<lemon::StaticDigraphBase::Arc, int>, true> 
   >::SetPathTraits<lemon::SimplePath<lemon::StaticDigraph> > >' with only 
   non-default constructor in class without a constructor
make[2]: *** [test/min_cost_flow_test.o] Error 1

Attachments (1)

354-a93f1a27d831.patch (1.7 KB) - added by kpeter 8 years ago.

Download all attachments as: .zip

Change History (3)

Changed 8 years ago by kpeter

comment:1 follow-up: Changed 8 years ago by kpeter

  • Status changed from new to assigned

The attached patch [a93f1a27d831] solves this issue. It compiles well with gcc 3.3, 3.4, 4.0, 4.1, 4.2. It should only be merged into the main branch. (The affected files are not in branch 1.1.)

It is a kind of tricky bug indeed. It seems that gcc 3.3 requires that a class has a default constructor if it has template named parameters. (That constructor could be set to protected.) I did not recognize the reason why such protected constructors are included in Bfs, Dfs, Dijkstra, Preflow, etc., so I did not copied them into the classes that I wrote. The attached patch fixes it.

comment:2 in reply to: ↑ 1 Changed 8 years ago by kpeter

  • Resolution set to fixed
  • Status changed from assigned to closed

Replying to kpeter:

The attached patch [a93f1a27d831] solves this issue. It compiles well with gcc 3.3, 3.4, 4.0, 4.1, 4.2. It should only be merged into the main branch. (The affected files are not in branch 1.1.)

It went to the main branch.

Note: See TracTickets for help on using tickets.