2014-02-07 Casey Carter <
cart...@gmail.com>:
>
> On Friday, February 7, 2014 8:41:07 AM UTC-6, Daniel Krügler wrote:
>>
>>
>> This is QoI, the behaviour is undefined and doesn't require a
>> diagnostics. Maybe the vendor provides an extension.
>>
> The requirement is from 29.5 [atomics.types.generic]/1:
>
>> There is a generic class template atomic<T>. The type of the template
>> argument T shall be trivially
>> copyable (3.9). [ Note: Type arguments that are not also statically
>> initializable may be difficult to use.
>> --end note ]
>
> Which, unless I misunderstand 1.4/1, should require the implementation to
> diagnose programs violating the requirement as ill-formed.
1.4/1 holds for the complete standard, but is in particular relevant
for the core language. Beyond Clause 17 you are in "Library Land" and
you are mostly directed by 17.6.4.8 [res.on.functions], especially p1
"In certain cases (replacement functions, handler functions,
operations on types used to instantiate standard
library template components), the C++ standard library depends on
components supplied by a C++ program.
If these components do not meet their requirements, the Standard
places no requirements on the
implementation."
p2 b3 says more about this:
"In particular, the effects are undefined in the following cases:
[..]
-- for types used as template arguments when instantiating a template
component, if the operations on
the type do not implement the semantics of the applicable Requirements
subclause (17.6.3.5, 23.2,
24.2, 26.2). Operations on such types can report a failure by throwing
an exception unless otherwise
specified."
- Daniel