Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 323599 - "Goto declaration" goes to non const member from const function.
Summary: "Goto declaration" goes to non const member from const function.
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-parser (show other bugs)
Version: 7.0   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 7.0.1   Edit
Assignee: Markus Schorn CLA
QA Contact: Mike Kucera CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-25 08:07 EDT by Vasiliy Dybala CLA
Modified: 2010-08-25 11:23 EDT (History)
0 users

See Also:


Attachments
testcase + fix (4.14 KB, patch)
2010-08-25 09:29 EDT, Markus Schorn CLA
mschorn.eclipse: iplog-
Details | Diff
improved fix + testcase (6.06 KB, patch)
2010-08-25 10:04 EDT, Markus Schorn CLA
mschorn.eclipse: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vasiliy Dybala CLA 2010-08-25 08:07:09 EDT
class iterator;
class const_iterator;

class container
{
public:
  iterator* begin();
  const_iterator* begin() const;
};

struct test
{
	void test_func() const
	{
		cnt.begin();
	}

	container cnt;
};

1. move cursor to cnt.begin(); and choose goto declaration.

cursor will move to  "iterator* begin();" instead "const_iterator* begin() const;"


-- Configuration Details --
Product: Eclipse 1.3.0.20100617-0520 (org.eclipse.epp.package.cpp.product)
Installed Features:
 org.eclipse.platform 3.6.0.v20100602-9gF78GpqFt6trOGhL60z0oEx3fz-JKNwxPY
Comment 1 Markus Schorn CLA 2010-08-25 08:25:18 EDT
Thanks, I suspect that we fail to compute the correct expression type for the id-expression 'cnt'.
Comment 2 Markus Schorn CLA 2010-08-25 09:29:27 EDT
Created attachment 177415 [details]
testcase + fix
Comment 3 Markus Schorn CLA 2010-08-25 10:04:56 EDT
Created attachment 177423 [details]
improved fix + testcase

Improved patch takes into account whether the field is mutable or not.
Comment 4 Markus Schorn CLA 2010-08-25 10:24:29 EDT
Fixed in 7.0.1 and 8.0 > 20100825.
Comment 5 CDT Genie CLA 2010-08-25 11:23:04 EDT
*** cdt cvs genie on behalf of mschorn ***
Bug 323599: Type of id-expression denoting a field access.

[*] CPPASTIdExpression.java 1.24.2.1 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTIdExpression.java?root=Tools_Project&r1=1.24&r2=1.24.2.1
[*] CPPASTFieldReference.java 1.30.2.1 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFieldReference.java?root=Tools_Project&r1=1.30&r2=1.30.2.1

[*] AST2CPPTests.java 1.345.2.3 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java?root=Tools_Project&r1=1.345.2.2&r2=1.345.2.3

[*] AST2CPPTests.java 1.356 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java?root=Tools_Project&r1=1.355&r2=1.356

[*] CPPASTIdExpression.java 1.26 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTIdExpression.java?root=Tools_Project&r1=1.25&r2=1.26
[*] CPPASTFieldReference.java 1.33 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFieldReference.java?root=Tools_Project&r1=1.32&r2=1.33