Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A3-3-2 Contradictory examples?
#1
In Rule A3-3-2, there's an example with "class A" which has a non-constexpr, user-defined constructor. 

On line 31, we have a compliant example:
Code:
A instance{}; // Compliant - constant (value) initialization

However, on line 37 it's no longer compliant:

Code:
static A a{}; // Non-compliant - A’s default c’tor is not constexpr

There seems to be a contradiction here. Either the code is doing value initialization, or it's calling a constructor, but not both. Which one is it?

In other words, it seems like both examples are doing the same thing, so both should either be compliant or non-compliant. Would you agree?
Reply


Messages In This Thread
A3-3-2 Contradictory examples? - by cgpzs - 17-03-2025, 09:58 AM
RE: A3-3-2 Contradictory examples? - by misra cpp - 28-03-2025, 01:49 PM
RE: A3-3-2 Contradictory examples? - by cgpzs - 31-03-2025, 09:30 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)