Changeset 395fc37 for src/tests


Ignore:
Timestamp:
Mar 16, 2017, 6:14:32 PM (7 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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:
615a096
Parents:
6f95000 (diff), 1fbab5a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg2:software/cfa/cfa-cc

Location:
src/tests
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/tests/.expect/tuplePolymorphism.txt

    r6f95000 r395fc37  
    33123 999.123 456
    44246 1998.25 912
     51.21 x 10.21 1111 v 54385938 1111 v 54385938
  • src/tests/memberCtors.c

    r6f95000 r395fc37  
    3030  WrappedInt x, y, z;
    3131};
     32
     33void ?{}(A * a) {
     34  // currently must define default ctor, since there's no "= default" syntax
     35}
    3236
    3337void ?{}(A * a, int x) {
  • src/tests/tuplePolymorphism.c

    r6f95000 r395fc37  
    1414//
    1515
     16// packed is needed so that structs are not passed with the same alignment as function arguments
     17__attribute__((packed)) struct A {
     18  double x;
     19  char y;
     20  double z;
     21};
     22
     23__attribute__((packed)) struct B {
     24  long long x;
     25  char y;
     26  long long z;
     27};
     28
     29// ensure that f is a viable candidate for g, even though its parameter structure does not exactly match
     30[A] f([A, B] x, B y) { printf("%g %c %g %lld %c %lld %lld %c %lld\n", x.0.[x,y,z], x.1.[x,y,z], y.[x,y,z]); return x.0; }
     31forall(otype T, otype U | { T f(T, U, U); })
     32void g(T x, U y) { f(x, y, y); }
     33
     34// add two triples
    1635forall(otype T | { T ?+?(T, T); })
    1736[T, T, T] ?+?([T, T, T] x, [T, T, T] y) {
     
    4059  [x1, x2, x3] = zzz+zzz;
    4160  printf("%d %g %d\n", x1, x2, x3);
     61
     62  // ensure non-matching assertions are specialized correctly
     63  g((A){ 1.21, 'x', 10.21}, (B){ 1111LL, 'v', 54385938LL });
    4264}
    4365
Note: See TracChangeset for help on using the changeset viewer.