OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc4/] [gcc/] [testsuite/] [obj-c++.dg/] [cxx-ivars-1.mm] - Diff between revs 308 and 519

Only display areas with differences | Details | Blame | View Log

Rev 308 Rev 519
// Check if ivars may be accessed via the C++ dot notation.
// Check if ivars may be accessed via the C++ dot notation.
// { dg-do run }
// { dg-do run }
// { dg-options "-fno-objc-call-cxx-cdtors" }
// { dg-options "-fno-objc-call-cxx-cdtors" }
// { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } }
// { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } }
#include "../objc-obj-c++-shared/Object1.h"
#include "../objc-obj-c++-shared/Object1.h"
#include 
#include 
#define CHECK_IF(expr) if(!(expr)) abort()
#define CHECK_IF(expr) if(!(expr)) abort()
struct cxx_struct {
struct cxx_struct {
  int a, b;
  int a, b;
  void set_values (int _a, int _b = 3) {
  void set_values (int _a, int _b = 3) {
    a = _a; b = _b;
    a = _a; b = _b;
  }
  }
  ~cxx_struct (void) {
  ~cxx_struct (void) {
    a = b = 99;
    a = b = 99;
  }
  }
};
};
@interface Manip : Object {
@interface Manip : Object {
  int c;
  int c;
  cxx_struct s;   // { dg-warning "user-defined destructor" }
  cxx_struct s;   // { dg-warning "user-defined destructor" }
                  // { dg-warning "constructors and destructors will not be invoked" "" { target *-*-* } 22 }
                  // { dg-warning "constructors and destructors will not be invoked" "" { target *-*-* } 22 }
}
}
- (void) manipulate_ivars;
- (void) manipulate_ivars;
@end
@end
@implementation Manip
@implementation Manip
- (void) manipulate_ivars {
- (void) manipulate_ivars {
  s.set_values (7);
  s.set_values (7);
  CHECK_IF (s.a == 7 && s.b == 3);
  CHECK_IF (s.a == 7 && s.b == 3);
  s.~cxx_struct();
  s.~cxx_struct();
  CHECK_IF (s.a == 99 && s.b == 99);
  CHECK_IF (s.a == 99 && s.b == 99);
}
}
@end
@end
int main (void)
int main (void)
{
{
  Manip *obj = [Manip new];
  Manip *obj = [Manip new];
  [obj manipulate_ivars];
  [obj manipulate_ivars];
  [obj free];
  [obj free];
}
}
#include "../objc-obj-c++-shared/Object1-implementation.h"
#include "../objc-obj-c++-shared/Object1-implementation.h"
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.