This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Migration from GCC3.4.3 to GCC4.1.2


Hi,
I suppose my fix is causing the above linker error.
I am attaching the issues and the solutions.

There are 2 compilation issues in templates
===========================================
1 - Explicit instantiation
==========================


Original Code
=============
namespace test
{ 
	namespace CMC
	{
		TYPE_CLASS_MODIFIER template class testLIB_API
test::Pair<test::MapIterator<const test::tstring, long>, bool>;
	}
}




Error : error: explicit instantiation of 'class
test::Pair<test::MapIterator<const test::String<wchar_t>, long int>, bool>'
in namespace 'test::CMC' (which does not enclose namespace 'test')

Modified Code
=============

namespace test
{ 
	namespace CMC
	{
	}
	TYPE_CLASS_MODIFIER template class testLIB_API
test::Pair<test::MapIterator<const test::tstring, long>, bool>;
}


2 - too few template parameter lists
=====================================

Original Code
==============

int mlyy::basic_scanner<SCAN_CLASS::token_type,
		    SCAN_CLASS::location_type,
		    SCAN_CLASS::scanner_id,
		    SCAN_CLASS::lock_type>::start_condition() const
{
  return 1;
}


Error : 2 - too few template parameter lists

Modified Code
=============
template<typename Token, typename Location, 
		int id, typename Lock>

int
mlyy::basic_scanner<Token, Location, id, Lock>::start_condition() const
{
  return 1;
}

Please comment on this.
Note : This compilation issue is not found with GCC 3.4.3. This is only with
GCC 4.1.2
-ruks


John (Eljay) Love-Jensen wrote:
> 
> Hi ruks,
> 
> Are you using explicit template instantiation?
> 
> If you look at ConfigTest.cpp line 638, is the body for
> ylmm::basic_parser<action::expression, ylmm::basic_location, 0,
> ylmm::basic_lock>:arse(void*) in a template header file (.h) being
> including by ConfigTest.cpp (or in ConfigTest.cpp itself)?
> 
> If the body is not in the template header file (and not in ConfigTest.cpp
> itself), I recommend putting the body of the arse() method into the
> appropriate template header file and use vague linkage instead of explicit
> template instantiation.
> 
> If you really prefer explicit template instantiation, I recommend checking
> to see why the .o which should have the instantiation of the arse() method
> does not have it instantiated.
> 
> Likewise for the other link-time missing templates methods and/or
> functions.
> 
> HTH,
> --Eljay
> 
> 

-- 
View this message in context: http://www.nabble.com/Migration-from-GCC3.4.3-to-GCC4.1.2-tp23295500p23403060.html
Sent from the gcc - Help mailing list archive at Nabble.com.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]