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

Bug 331985

Summary: Failing refactoring test
Product: [Tools] CDT Reporter: Emanuel Graf <emanuel>
Component: cdt-refactoringAssignee: Emanuel Graf <emanuel>
Status: RESOLVED FIXED QA Contact: Emanuel Graf <emanuel>
Severity: normal    
Priority: P3 CC: cdtdoug, mschorn.eclipse
Version: 8.0   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Fix and test case for Markus's example emanuel: iplog-

Description Emanuel Graf CLA 2010-12-07 03:02:46 EST
Some changes caused 2 tests to fail.
Comment 1 Emanuel Graf CLA 2010-12-07 05:12:55 EST
The failing tests are caused by a change in CPPASTIdExpression.getExpressionType(). The type for this example was "CPPTypedef foo" and now is "CompositeCPPClassInstance std::basic_string<char,std::char_traits<char>,std::allocator<char>>"


#include <string>

typedef std::string foo;

int main() {
    foo s = "foo";
    s = 
      "<" + s + ">"; //Expression of interest
    return 0;
}

Markus can you point me to an solution for this?
Comment 2 Markus Schorn CLA 2010-12-07 07:26:39 EST
The typedef is expanded, because the type of the id-expression can be different to the type of the variable. E.g.:

typedef int& foo;  
int test(foo s) {
   int a= s + 1;  // type of id-expression 's' is int, not 'foo' or 'int&'
}

The original type of the variable can be obtained via 
IBinding b= IASTIdExpression.getName().resolveBinding();
IType varType= ((IVariable) b).getType();
Comment 3 Emanuel Graf CLA 2010-12-07 08:24:03 EST
Created attachment 184715 [details]
Fix and test case for Markus's example
Comment 5 Emanuel Graf CLA 2010-12-07 09:43:22 EST
Fixed in HEAD > 20101207