Changeset b93a3de


Ignore:
Timestamp:
Oct 19, 2017, 11:15:35 AM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
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:
86f852b
Parents:
f232977
git-author:
Rob Schluntz <rschlunt@…> (10/13/17 16:07:34)
git-committer:
Rob Schluntz <rschlunt@…> (10/19/17 11:15:35)
Message:

Update ctor-autogen test case

Location:
src/tests
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • src/tests/Makefile.am

    rf232977 rb93a3de  
    133133        ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
    134134
     135ctor-autogen-ERR1: ctor-autogen.c @CFA_BINDIR@/@CFA_NAME@
     136        ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
     137
    135138completeTypeError : completeTypeError.c @CFA_BINDIR@/@CFA_NAME@
    136139        ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
  • src/tests/Makefile.in

    rf232977 rb93a3de  
    886886        ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
    887887
     888ctor-autogen-ERR1: ctor-autogen.c @CFA_BINDIR@/@CFA_NAME@
     889        ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
     890
    888891completeTypeError : completeTypeError.c @CFA_BINDIR@/@CFA_NAME@
    889892        ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
  • src/tests/ctor-autogen.c

    rf232977 rb93a3de  
    3232};
    3333
     34// managed type - defines a constructor - can't use field constructors
     35struct Managed {
     36        int x;
     37};
     38
     39void ?{}(Managed & m) { m.x = 0; }
     40
     41// managed type since it contains a managed type - can't use field constructors
     42struct InheritManaged {
     43        Managed m;
     44};
     45
    3446forall(otype T)
    3547T identity(T x) { return x; }
     
    4961        identity(s);  // S should be an otype
    5062
     63        SimpleStruct ss;
     64        SimpleUnion su;
     65
     66        identity(ss);
     67        identity(su);
     68
    5169        PopulatedStruct ps;
    5270        PopulatedUnion pu;
     
    5472        identity(ps); // should recursively be an otype
    5573        identity(pu); // should recursively be an otype
     74
     75#if ERR1
     76        Managed x = { 123 }; // error
     77        Managed y;           // okay
     78
     79        InheritManaged z = { y };  // error?
     80#endif
     81
    5682}
Note: See TracChangeset for help on using the changeset viewer.