Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 352704 - Go to declaration (F3) for function fails if function contains std::string
Summary: Go to declaration (F3) for function fails if function contains std::string
Status: CLOSED INVALID
Alias: None
Product: CDT
Classification: Tools
Component: cdt-indexer (show other bugs)
Version: 8.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Markus Schorn CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-21 03:41 EDT by Michael CLA
Modified: 2011-07-25 00:25 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael CLA 2011-07-21 03:41:11 EDT
Build Identifier: Build id: 20110218-0911

The function that is broken in the C++ IDE is (in the text editor) selecting a C++ class function declaration in the header file (.h), hitting F3 and expecting to go to the function declaration in the implementation (.cpp) file.

This "go to declaration" doesn't work if the function either:
 - returns std::string, or
 - has argument of std::string

What is interesting is that if I typedef the std::string to eg stdstring, the "go to declaration" feature works.

Reproducible: Always

Steps to Reproduce:
------------------
1.Create header file containing class...

#ifndef TESTCLASS_H_
#define TESTCLASS_H_

#include <string>

using namespace std;
typedef std::string stdstring;

class testClass
{
public:
	testClass();
	virtual ~testClass();

	void f3_works_a(stdstring a);
	void f3_doesntwork_b(std::string b);
	void f3_doesntwork_c(string c);
	stdstring f3_works_d();
	std::string f3_doesntwork_e();
	string f3_doesntwork_f();
	
};

#endif /* TESTCLASS_H_ */

------------------
2. Create implementation file containing

#include "testClass.h"
testClass::testClass(){}
testClass::~testClass(){}
void testClass::f3_works_a(stdstring a){}
void testClass::f3_doesntwork_b(std::string b){}
void testClass::f3_doesntwork_c(string c){}
stdstring testClass::f3_works_d(){}
std::string testClass::f3_doesntwork_e(){}
string testClass::f3_doesntwork_f(){}

------------------
3. For each function in the header file, select and hit F3

You will see that "go to declaration" for functions a & d work, and functions b, c, e, f do not work.
Comment 1 Marc-André Laperle CLA 2011-07-22 18:30:12 EDT
They all work for me on Mac OS X 10.6 with GCC 4.2 and Windows 7 with some MinGW GCC 4.4.1. Can you specify your Linux distribution and GCC version? I'll try to reproduce with a similar setup.
Comment 2 Marc-André Laperle CLA 2011-07-22 19:00:46 EDT
Also tried Ubuntu 11.04 with GCC 4.5.2.
Comment 3 Michael CLA 2011-07-25 00:25:27 EDT
I have been able to get the F3 'go to declaration' feature working correctly, for all function types (as described in this bug report).

The fix was to:
1. Enable 'Automate discovery of paths and symbols'
2. Clean and rebuild my application
3. Rebuild my index

See http://wiki.eclipse.org/CDT/User/FAQ#How_do_I_contribute_to_this_FAQ.3F

I was a recent convert from Eclipse Ganymede , which (I suspect) had 'Automate discovery of paths and symbols' enabled by default.

I'm happy to therefore close this bug report.