Which item stipulates that A() is a prvalue?

1
2
3
4
5
  class A {
    ...
  };

  A();


This webpage lists all possible forms of prvalue expressions: https://en.cppreference.com/w/cpp/language/value_category#prvalue. Which item stipulates that A() is a prvalue? I am guessing this item is plausible:

• a function call or an overloaded operator expression, whose return type is non-reference, such as ...

A() is a call to default constructor which is a (special) member function, and it does not return anything (so its return type is not a reference). But I am not sure, and the following examples do not contain expressions like A(). So I ask here for a confirmation. Thank you.
I suspect so, but cppreference.com is not the official specification so it's possible that its explanation is not 100% perfect.

If you instead look at the top of the page it says that a prvalue is an expression whose evaluation initializes an object.

The same wording is also present in the standard itself: https://eel.is/c++draft/basic.lval#1.2

The expression A() clearly initializes an object.
Last edited on
I believe that A() is a function-style cast expression and is covered by

• a cast expression to non-reference type, such as static_cast<double>(x), std::string{}, or (int)42
in the cppreference page.

See case 2 here:
https://en.cppreference.com/w/cpp/language/explicit_cast
Registered users can post here. Sign in or register to post.