Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java')
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java94
1 files changed, 94 insertions, 0 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java
index 97b8e1f9f70..41fe973a720 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java
@@ -12,6 +12,7 @@
* Andrew Ferguson (Symbian)
* Sergey Prigogin (Google)
* Thomas Corbat (IFS)
+ * Nathan Ridge
*******************************************************************************/
package org.eclipse.cdt.core.parser.tests.ast2;
@@ -9985,4 +9986,97 @@ public class AST2CPPTests extends AST2BaseTest {
public void testIsBaseOf_395019() throws Exception {
parseAndCheckBindings(getAboveComment(), CPP, true);
}
+
+ // struct Bool { Bool(bool); };
+ // struct Char { Char(char); };
+ // struct Short { Short(short); };
+ // struct Int { Int(int); };
+ // struct UInt { UInt(unsigned int); };
+ // struct Long { Long(long); };
+ // struct ULong { ULong(unsigned long); };
+ // struct Float { Float(float); };
+ // struct Double { Double(double); };
+ // struct LongDouble { LongDouble(long double); };
+ // void fbool(Bool);
+ // void fchar(Char);
+ // void fshort(Short);
+ // void fint(Int);
+ // void flong(Long);
+ // void fuint(UInt);
+ // void fulong(ULong);
+ // void ffloat(Float);
+ // void fdouble(Double);
+ // void flongdouble(LongDouble);
+ // enum UnscopedEnum : int { x, y, z };
+ //
+ // int main() {
+ // bool vbool;
+ // char vchar;
+ // short vshort;
+ // unsigned short vushort;
+ // int vint;
+ // unsigned int vuint;
+ // long vlong;
+ // float vfloat;
+ // double vdouble;
+ // long double vlongdouble;
+ // UnscopedEnum vue;
+ //
+ // // Narrowing conversions
+ // fint({vdouble});
+ // ffloat({vlongdouble});
+ // ffloat({vdouble});
+ // fdouble({vlongdouble});
+ // fdouble({vint});
+ // fdouble({vue});
+ // fshort({vint});
+ // fuint({vint});
+ // fint({vuint});
+ // fulong({vshort});
+ // fbool({vint});
+ // fchar({vint});
+ //
+ // // Non-narrowing conversions
+ // fint({vshort});
+ // flong({vint});
+ // fuint({vushort});
+ // flong({vshort});
+ // fulong({vuint});
+ // fulong({vushort});
+ // fdouble({vfloat});
+ // flongdouble({vfloat});
+ // flongdouble({vdouble});
+ // fint({vbool});
+ // fint({vchar});
+ // }
+ public void testNarrowingConversionsInListInitialization_389782() throws Exception {
+ BindingAssertionHelper helper = getAssertionHelper();
+
+ // Narrowing conversions
+ helper.assertProblemOnFirstIdentifier("fint({vdouble");
+ helper.assertProblemOnFirstIdentifier("ffloat({vlongdouble");
+ helper.assertProblemOnFirstIdentifier("ffloat({vdouble");
+ helper.assertProblemOnFirstIdentifier("fdouble({vlongdouble");
+ helper.assertProblemOnFirstIdentifier("fdouble({vint");
+ helper.assertProblemOnFirstIdentifier("fdouble({vue");
+ helper.assertProblemOnFirstIdentifier("fshort({vint");
+ helper.assertProblemOnFirstIdentifier("fuint({vint");
+ helper.assertProblemOnFirstIdentifier("fint({vuint");
+ helper.assertProblemOnFirstIdentifier("fulong({vshort");
+ helper.assertProblemOnFirstIdentifier("fbool({vint");
+ helper.assertProblemOnFirstIdentifier("fchar({vint");
+
+ // Non-narrowing conversions
+ helper.assertNonProblemOnFirstIdentifier("fint({vshort");
+ helper.assertNonProblemOnFirstIdentifier("flong({vint");
+ helper.assertNonProblemOnFirstIdentifier("fuint({vushort");
+ helper.assertNonProblemOnFirstIdentifier("flong({vshort");
+ helper.assertNonProblemOnFirstIdentifier("fulong({vuint");
+ helper.assertNonProblemOnFirstIdentifier("fulong({vushort");
+ helper.assertNonProblemOnFirstIdentifier("fdouble({vfloat");
+ helper.assertNonProblemOnFirstIdentifier("flongdouble({vfloat");
+ helper.assertNonProblemOnFirstIdentifier("flongdouble({vdouble");
+ helper.assertNonProblemOnFirstIdentifier("fint({vbool");
+ helper.assertNonProblemOnFirstIdentifier("fint({vchar");
+ }
}

Back to the top