cpp-common/bt2: use more specific static assertion messages
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Sat, 11 Nov 2023 03:36:09 +0000 (22:36 -0500)
committerSimon Marchi <simon.marchi@efficios.com>
Thu, 14 Dec 2023 15:57:04 +0000 (10:57 -0500)
commit5c895f64223b174af848b766d3b76058fb0f542e
treefabb7a493082dc53d7a518087ce7857281b25c9f
parent328a274a0722349196f8c7161dce7d5adc7e2489
cpp-common/bt2: use more specific static assertion messages

The current

    `LibObjT` must NOT be `const`.

static assertion message is pretty generic. For a typical
`bt2::ConstXyz` user, `LibObjT` actually means nothing, because she's
not using `bt2::CommonXyz` directly, only an alias.

Make the message specific, for example:

    Not available with `bt2::ConstBoolValue`.

For example, with:

    void lel(bt2::ConstBoolValue val)
    {
        val = false;
    }

I get:

    cpp-common/bt2/value.hpp: In instantiation of ‘bt2::CommonBoolValue<LibObjT>& bt2::CommonBoolValue<LibObjT>::operator=(Value) const [with LibObjT = const bt_value; Value = bool]’:
    test.cpp:61:11:   required from here
    cpp-common/bt2/value.hpp:349:48: error: static assertion failed: Not available with `bt2::ConstBoolValue`.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I4e96d4dcd1cc345d8b393aea6bb78fbc0000e9ba
Reviewed-on: https://review.lttng.org/c/babeltrace/+/11361
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
src/cpp-common/bt2/clock-class.hpp
src/cpp-common/bt2/field-class.hpp
src/cpp-common/bt2/field.hpp
src/cpp-common/bt2/integer-range-set.hpp
src/cpp-common/bt2/message.hpp
src/cpp-common/bt2/trace-ir.hpp
src/cpp-common/bt2/value.hpp
This page took 0.025385 seconds and 4 git commands to generate.