Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2007-06-14 16:56:24

David Abrahams wrote:
> on Thu Jun 14 2007, Eric Niebler <> wrote:
>> template<typename T> struct static_const
>> {
>> static T const value;
>> };
>> template<typename T>
>> T const static_const<T>::value = {};
>> struct placeholder {};
>> // This is *supposed* to be statically initialized but many
>> // compilers do dynamic initialization for it. :-(
>> placeholder const &_1 = static_const<placeholder>::value;
> I thought it was just MSVC. Any others?

Shoot, now I can't remember. How many did we test? Well, this much is
certain, there is at least one compiler that does dynamic initialization
for it. :-/

I also seem to recall that there was still some question as to whether
the use of the reference violated the ODR, if the reference is not
optimized away. I don't think we ever got an answer to that question.

Eric Niebler
Boost Consulting
The Astoria Seminar ==>

Boost list run by bdawes at, gregod at, cpdaniel at, john at