Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 357624

Summary: boost library not usable with CDT 8.0 and codan (indexer problem ?)
Product: [Tools] CDT Reporter: Bernhard Merkle <bernhard.merkle>
Component: cdt-codanAssignee: CDT Codan Inbox <cdt-codan-inbox>
Status: RESOLVED WORKSFORME QA Contact: Elena Laskavaia <elaskavaia.cdt>
Severity: major    
Priority: P3 CC: cdtdoug, malaperle, yevshif, zeratul976
Version: 8.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Bernhard Merkle CLA 2011-09-14 08:43:35 EDT
Build Identifier: I20110613-1736

There is a major problem with using the boost library with CDT 8.0 and codan.
Please note that the same example works under CDT 7.0.

Using the example below I get the following error message from codan in CDT 8.0.
Type 'boost::add_const<T>::type' could not be resolved	

Workaround: If I deactivate the "Syntax and Semantic Errors" in codan, the error goes away. This category was not present in CDT 7.0 so the problem did not show up there.

I think underlying maybe a problem with the CDT indexer (which does not resolve the symbol). However as you can see the example is very small and it shows that there is a general problem with using boost and CDT 8.0. 





 #include <boost/static_assert.hpp>
 #include <boost/type_traits/is_same.hpp>
 #include <boost/type_traits/add_reference.hpp>
 #include <boost/type_traits/add_const.hpp>
 
template<typename T>
 struct add_const_ref
 {
     typedef typename boost::add_const<T>::type ct;
     typedef typename boost::add_reference<ct>::type type;
 };

 template<typename T1, typename T2>
 void same()
 {
     const bool v = boost::is_same<T1, T2>::value;
     BOOST_STATIC_ASSERT(v);
 }

 int main()
 {
     same<const char &, add_const_ref<char>::type>();
     same<int * const &, add_const_ref<int *>::type>();
     same<int &, add_const_ref<int &>::type>();
     same<const long &, add_const_ref<const long &>::type>();

	 same<const long &, add_const_ref<long>::type>();
	 return 0;
 }

Reproducible: Always

Steps to Reproduce:
1. use example attached
2. build or run codeanalysis
3. fails with CDT 8.0, works with CDT 7.0
maybe a problem with the indexer which shows up in codan.
workaround is to deaktivate category "Syntax and Semantic Errors"
Comment 1 Bernhard Merkle CLA 2011-09-14 08:49:40 EDT
btw boost::add_const does not show up in the codecompletion.

The program compiles and runs fine, but the indexer seems to have a major problem.
Comment 2 Elena Laskavaia CLA 2011-10-24 20:59:44 EDT
If you go to global indexer settings and remove all pre-indexer headers, then re-build index for this project - does it help?
Comment 3 Bernhard Merkle CLA 2011-11-02 19:43:34 EDT
(In reply to comment #2)
> If you go to global indexer settings and remove all pre-indexer headers, then
> re-build index for this project - does it help?

no. unfortunately it does not help.

are you able to reproduce the error ?
Comment 4 Marc-André Laperle CLA 2011-11-04 01:27:02 EDT
I tested this example with Boost 1.46.1 and I see the errors with CDT 8.0.1 but not with a recent build of 8.1 (8.1.0.201111031005). I assume this was fixed with bug 197989. You can get a nightly build of 8.1 here:
https://hudson.eclipse.org/hudson/job/cdt-nightly/

Also, using 8.1, boost::add_const shows up in the completion.
Comment 5 Nathan Ridge CLA 2013-07-21 19:05:18 EDT
Works fine for me with CDT 8.2 and Boost 1.54.
Comment 6 Nathan Ridge CLA 2016-12-29 01:14:13 EST
Closing per comment 5. Feel free to reopen if you're still seeing this.