Home | History | Annotate | Download | only in jni
      1 /* This file is here to check for the following bug report:
      2  *   http://code.google.com/p/android/issues/detail?id=16010
      3  */
      4 #include <stdio.h>
      5 
      6 class A {
      7 public:
      8   static A* instance() {
      9     static A _instance;
     10     return &_instance;
     11   }
     12 };
     13 
     14 int main() {
     15     A* first = A::instance();
     16     A* second = A::instance();
     17 
     18     if (first != second) {
     19         fprintf(stderr, "ERROR: instance() returned two distinct addresses: %p %p\n", first, second);
     20         return 1;
     21     }
     22     printf("OK: instance() returned the same address twice: %p\n", first);
     23    return 0;
     24 }
     25