I found the following way that makes the warning message [-Wmissing-braces] 
disappear.

Instead of using the instruction provided in the *block_linear_operator.h*

* block_operator<2, 2, BlockVector<double>>({op_a00, op_a01, op_a10, 
op_a11});*

We can declare the block_operator the way below:
const std::array<std::array<dealii::LinearOperator<dealii::Vector<double>,
                                                   dealii::Vector<double>,
   dealii::internal::LinearOperatorImplementation::EmptyPayload>,
   2>, 2>
ops = {{
                    {{ op_uMuT, op_uMdT }},
    {{ op_dMuT, op_dMdT }}
   }};

const auto op_zT_wMwT_z = block_operator<2, 2, BlockVector<double>>(ops);

This way, the warning message will disappear during the compilation.

Best,

Tao


On Wednesday, March 25, 2026 at 3:04:00 PM UTC-4 Tao Jin wrote:

> Hi Wolfgang,
>
> Thanks for your reply. I dug into the dealii source code and here is what 
> I found.
>
> Below is the instruction for the constructor
> /**
>  * @relatesalso BlockLinearOperator
>  *
>  * A variant of above function that encapsulates a given collection @p ops 
> of
>  * LinearOperators into a block structure. Here, it is assumed that Range 
> and
>  * Domain are block vectors, i.e., derived from
>  * @ref BlockVectorBase.
>  * The individual linear operators in @p ops must act on the underlying 
> vector
>  * type of the block vectors, i.e., on Domain::BlockType yielding a result 
> in
>  * Range::BlockType.
>  *
>  * The list @p ops is best passed as an initializer list. Consider for 
> example
>  * a linear operator block (acting on Vector<double>)
>  * @code
>  *  op_a00 | op_a01
>  *         |
>  *  ---------------
>  *         |
>  *  op_a10 | op_a11
>  * @endcode
>  * The corresponding block_operator invocation takes the form
>  * @code
>
> * * block_operator<2, 2, BlockVector<double>>({op_a00, op_a01, op_a10, 
> op_a11});* * @endcode
>  *
>  * @ingroup LAOperators
>  */
>
> I followed the above instruction but still got the same warning message 
> during compilation.
>
> Also, in the source code (*block_linear_operator.h*)
>
> https://dealii.org/current/doxygen/deal.II/block__linear__operator_8h_source.html
>
> On line 665 there is a *TODO* tag:
> // TODO: Create block payload so that this can be initialized correctly
> BlockLinearOperator<Range, Domain, BlockPayload> 
> <https://dealii.org/current/doxygen/deal.II/classBlockLinearOperator.html#ad2533970716e61d8476d73b5977d1d89>
>  
> return_op{BlockPayload()};
>
> I wonder whether this is the reason for the warning message. (Sorry that 
> my C++ skill is not good enough to fix this myself since the 
> block_linear_operator seems to be a quite complex class).
>
> Best,
>
> Tao
>
>
> On Wednesday, March 25, 2026 at 12:04:28 PM UTC-4 Wolfgang Bangerth wrote:
>
>> On 3/24/26 19:27, Tao Jin wrote: 
>> > 
>> > I tried to place some extra curly braces but the warining message is 
>> still there. 
>> > 
>> > Does anyone have any idea how to get rid of the warning message? 
>>
>> Sometimes it takes two more levels of braces. Alternatively, look up what 
>> the 
>> type of the constructor argument is and construct that explicitly, rather 
>> than 
>> in-place. 
>>
>> Best 
>> Wolfgang 
>>
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/dealii/5efc6d33-d4f6-4303-a64a-fabdbaea271cn%40googlegroups.com.

Reply via email to