Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Type promotion support?

Let me correct myself. The canonical way of getting _expression_ type is IASTExpression.getExpressionType(). It calls CPPVisitor.getExpressionType(IASTExpression _expression_) internally.

-sergey

On Sat, Jan 10, 2009 at 12:58 PM, Sergey Prigogin <eclipse.sprigogin@xxxxxxxxx> wrote:
The canonical way to get an _expression_ type is CPPVisitor.getExpressionType(IASTExpression _expression_) method. If you discover a case when this method doesn't produce the correct result, please file a bug to get it fixed.

-sergey

On Tue, Jan 6, 2009 at 3:58 PM, Tom Ball <tball@xxxxxxxxxx> wrote:
The extract function and extract local variable refactorings don't support type promotion:

    int x = 3;
    double y = (x + 2.5) * 15;
extract -------^^^^^^^^^  
->  int x = 3;
    int foo = x + 2.5;  // foo should be a double
    double y = foo * 15;

Are there existing methods that "merge" types (IASTDeclSpecifier), finding the correct shared type?  For primitive types it's straightforward, but I'd like to avoid the bog of C++ types which override binary operators.

Tom


_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev




Back to the top