Giter VIP home page Giter VIP logo

Comments (6)

daveedvdv avatar daveedvdv commented on July 20, 2024 1

from cxx-abi.

zygoloid avatar zygoloid commented on July 20, 2024

OK, that makes sense to me. From a specification point of view, I think at this point we should no longer rely on the C++03 definition and should instead directly describe what we mean:

"""
A type is considered a POD for the purposes of layout if (ignoring cv-qualifications) it is a scalar type, an array of whose element type is considered POD for the purposes of layout, or a class type that has:

  • no user-provided or inherited constructors,
  • no user-provided copy or move assignment operators,
  • no user-provided destructors,
  • no private or protected non-static data members,
  • no non-static reference members,
  • no bit-fields whose declared width is wider than the declared type of the bit-field,
  • no potentially-overlapping non-static data members,
  • no base classes,
  • no virtual functions,

and for which all non-static data members are of types considered POD for the purposes of layout.

This is intended to match the definition of POD in C++03, suitably extended to later language standards, and to identify a subset of types for which the base C ABI for the platform can be expected to compute a layout.
"""

Emphasized portions of the above are suggested changes from the current rule.

from cxx-abi.

jyknight avatar jyknight commented on July 20, 2024

Isn't saying "no inherited constructors" unnecessary, as there's a "no base classes" rule anyways?

And just to confirm: deleted constructors/destructors/move-assignment operators also won't make a type non-pod-for-layout, correct? Including if they're implicitly deleted by the declaration of a move assignment operator.

from cxx-abi.

jwakely avatar jwakely commented on July 20, 2024

@jyknight special members that are implicitly defined as deleted are not "user-provided".

[dcl.fct.def.default] p5
A function is user-provided if it is user-declared and not explicitly defaulted or deleted on its first declaration.

from cxx-abi.

jyknight avatar jyknight commented on July 20, 2024

GCC doesn't currently check for the existence of user-provided move-assignment operators, since C++03 didn't mention those. It checks only for user-provided constructor, copy assignment operator, and destructor.

Should the list above should be modified to remove the mention of move assignment operators?

from cxx-abi.

dwblaikie avatar dwblaikie commented on July 20, 2024

This has come up again in Clang here: https://reviews.llvm.org/D119051

from cxx-abi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.