Changeset c6e6333
- Timestamp:
- Oct 19, 2017, 11:13:11 AM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- eaa2edaa
- Parents:
- 8e138da
- git-author:
- Rob Schluntz <rschlunt@…> (10/06/17 16:16:35)
- git-committer:
- Rob Schluntz <rschlunt@…> (10/19/17 11:13:11)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tests/ctor-autogen.c
r8e138da rc6e6333 1 // TODO: add error cases (e.g., use of field constructors for managed types, etc.) 2 1 3 enum Color { R, G, B }; 2 4 … … 4 6 union U {}; 5 7 struct S {}; 8 9 struct SimpleUnion { 10 int x; 11 double y; 12 char z; 13 }; 14 15 struct SimpleStruct { 16 int x; 17 double y; 18 char z; 19 }; 6 20 7 21 // struct/union with members with generated ctor/dtors should themselves have generated ctor/dtors … … 13 27 14 28 struct PopulatedStruct { 15 Color state;29 Color c; 16 30 U u; 17 31 S s; … … 21 35 T identity(T x) { return x; } 22 36 37 // can identity e if only sized or only the assertion, but the combination breaks... 38 // forall(dtype T | sized(T) | { void ?{}(T &); }) 39 // void identity(T x) { } 40 23 41 int main() { 24 42 S s; 25 43 U u; 44 Color e; 26 45 27 identity(R); // Color should be an otype 46 // identity(R); // Color should be an otype 47 // identity((Color)e); 28 48 identity(u); // U should be an otype 29 49 identity(s); // S should be an otype
Note: See TracChangeset
for help on using the changeset viewer.