[Bug c++/23804] New: reference initialization with compile-time bogus value

2005-09-09 Thread ivan at sierra-da dot com
Type* p;
   ...// no value assigned to p
   Type& r = *p;  // should fail during compilation

-- 
   Summary: reference initialization with compile-time bogus value
   Product: gcc
   Version: 3.3.3
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ivan at sierra-da dot com
CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: linux/x86/2.6
  GCC host triplet: linux/x86/2.6
GCC target triplet: linux/x86/2.6


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23804


[Bug c++/23804] reference initialization with compile-time bogus value

2005-09-09 Thread ivan at sierra-da dot com

--- Additional Comments From ivan at sierra-da dot com  2005-09-10 02:23 
---
  Thanks

-- 
   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution||FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23804


[Bug c++/26723] New: invocation order of functions registered with atexit() not as expected

2006-03-16 Thread ivan at sierra-da dot com
Almost verbatim from the standard:
/// 1. Objects with static storage duration are destroyed
///and functions registered by calling atexit are
///called. Objects with static storage duration are
///destroyed in the reverse order of the completion
///of their constructor.
/// 2. Functions registered with atexit are called in the
///reverse order of their registration. A function
///registered with atexit before an object obj1 of static
///storage duration is initialized will not be called until
///obj1’s destruction has completed. A function registered
///with atexit after an object obj2 of static storage
///duration is initialized will be called before obj2 
///destruction starts.

#include 

static void pre_exit(void) {
std::cout << "@pre_exit" << std::endl;
}
static void post_exit(void) {
std::cout << "@post_exit" << std::endl;
}

struct FIRST {
FIRST() {
atexit(pre_exit);
std::cout << "FIRST::FIRST()" << std::endl;
}
~FIRST() {
std::cout << "FIRST::~FIRST()" << std::endl;
}
};
struct SECOND {
SECOND()  { std::cout << "SECOND::SECOND()" << std::endl; }
~SECOND() { std::cout << "SECOND::~SECOND()" << std::endl; }
};

static FIRST_first;
static SECOND   _second;

///
int main() {
if (atexit(post_exit)) { /* registration failed */ }
std::cout << "whatever" << std::endl;
std::cout.flush();
return 0;
}

/ the output is:
FIRST::FIRST()
SECOND::SECOND()
whatever
@post_exit
@pre_exit
SECOND::~SECOND()
FIRST::~FIRST()

/// where I would expect it to be:
FIRST::FIRST()
SECOND::SECOND()
whatever
@post_exit
SECOND::~SECOND()
@pre_exit
FIRST::~FIRST()

/// or maybe even
FIRST::FIRST()
SECOND::SECOND()
whatever
@post_exit
SECOND::~SECOND()
FIRST::~FIRST() // pre_exit was registered before FIRST() completed.
@pre_exit


-- 
   Summary: invocation order of functions registered with atexit()
not as expected
   Product: gcc
   Version: 3.3.3
Status: UNCONFIRMED
      Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ivan at sierra-da dot com
 GCC build triplet: linux/i686/rh9
  GCC host triplet: linux/i686/rh9
GCC target triplet: linux/i686/rh9


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26723



[Bug c++/26723] invocation order of functions registered with atexit() not as expected

2006-03-16 Thread ivan at sierra-da dot com


--- Comment #2 from ivan at sierra-da dot com  2006-03-16 21:56 ---
gcc -v:
Reading specs from
/project/tools/linux_i686_2.3.2-2005-08-31-17.44.37/stow/gcc-3.3.3/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/specs
Configured with: XXX/gcc-3.3.3/configure --prefix=XXXgcc-3.3.3
--with-local-prefix=XXX --enable-languages=c,c++
--with-libiconv-prefix=XXX/gcc-3.3.3 --with-gnu-ld --with-ld=XXX/bin/ld
--with-gnu-as --with-as=XXX/bin/as
Thread model: posix
gcc version 3.3.3

 also ---
g++ --enable-__cxa_atexit ...:
>>> cc1plus: error: unrecognized option `-fenable-__cxa_atexit'


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26723