mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 06:32:10 +02:00
Bug 506170 - Calculate sizeof(double) correctly
Change-Id: Ie0b4767a81ed529e827d1b9decd4d065225e8e5b
This commit is contained in:
parent
e7e66605f2
commit
f229ec9e44
3 changed files with 10 additions and 2 deletions
|
@ -12131,4 +12131,10 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
public void testDecltypeAutoReturnType_482225() throws Exception {
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// constexpr int waldo = (sizeof(double) % 16);
|
||||
public void testSizeofDouble_506170() throws Exception {
|
||||
BindingAssertionHelper helper = getAssertionHelper();
|
||||
helper.assertVariableValue("waldo", 8);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -151,6 +151,7 @@ public class AST2TestBase extends BaseTestCase {
|
|||
map.put("__SIZEOF_SHORT__", "2");
|
||||
map.put("__SIZEOF_INT__", "4");
|
||||
map.put("__SIZEOF_LONG__", "8");
|
||||
map.put("__SIZEOF_DOUBLE__", "8");
|
||||
map.put("__SIZEOF_POINTER__", "8");
|
||||
return map;
|
||||
}
|
||||
|
@ -160,6 +161,7 @@ public class AST2TestBase extends BaseTestCase {
|
|||
map.put("__SIZEOF_SHORT__", "2");
|
||||
map.put("__SIZEOF_INT__", "4");
|
||||
map.put("__SIZEOF_LONG__", "8");
|
||||
map.put("__SIZEOF_DOUBLE__", "8");
|
||||
map.put("__SIZEOF_POINTER__", "8");
|
||||
return map;
|
||||
}
|
||||
|
|
|
@ -238,8 +238,8 @@ public class SizeofCalculator {
|
|||
return type.isComplex() ? sizeof_complex_float : sizeof_float;
|
||||
case eDouble:
|
||||
return type.isComplex() ?
|
||||
(type.isLong() ? sizeof_long_double : sizeof_double) :
|
||||
(type.isLong() ? sizeof_complex_long_double : sizeof_complex_double);
|
||||
(type.isLong() ? sizeof_complex_long_double : sizeof_complex_double) :
|
||||
(type.isLong() ? sizeof_long_double : sizeof_double);
|
||||
case eFloat128:
|
||||
return type.isComplex() ? sizeof_complex_float128 : sizeof_float128;
|
||||
case eDecimal32:
|
||||
|
|
Loading…
Add table
Reference in a new issue