Skip to main content
Redhat Developers  Logo
  • Products

    Featured

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat OpenShift AI
      Red Hat OpenShift AI
    • Red Hat Enterprise Linux AI
      Linux icon inside of a brain
    • Image mode for Red Hat Enterprise Linux
      RHEL image mode
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • Red Hat Developer Hub
      Developer Hub
    • View All Red Hat Products
    • Linux

      • Red Hat Enterprise Linux
      • Image mode for Red Hat Enterprise Linux
      • Red Hat Universal Base Images (UBI)
    • Java runtimes & frameworks

      • JBoss Enterprise Application Platform
      • Red Hat build of OpenJDK
    • Kubernetes

      • Red Hat OpenShift
      • Microsoft Azure Red Hat OpenShift
      • Red Hat OpenShift Virtualization
      • Red Hat OpenShift Lightspeed
    • Integration & App Connectivity

      • Red Hat Build of Apache Camel
      • Red Hat Service Interconnect
      • Red Hat Connectivity Link
    • AI/ML

      • Red Hat OpenShift AI
      • Red Hat Enterprise Linux AI
    • Automation

      • Red Hat Ansible Automation Platform
      • Red Hat Ansible Lightspeed
    • Developer tools

      • Red Hat Trusted Software Supply Chain
      • Podman Desktop
      • Red Hat OpenShift Dev Spaces
    • Developer Sandbox

      Developer Sandbox
      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Secure Development & Architectures

      • Security
      • Secure coding
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
      • View All Technologies
    • Start exploring in the Developer Sandbox for free

      sandbox graphic
      Try Red Hat's products and technologies without setup or configuration.
    • Try at no cost
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • Java
      Java icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • API Catalog
    • Product Documentation
    • Legacy Documentation
    • Red Hat Learning

      Learning image
      Boost your technical skills to expert-level with the help of interactive lessons offered by various Red Hat Learning programs.
    • Explore Red Hat Learning
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

ISO C++ Jun 23 meeting trip report (core language)

October 9, 2023
Jason Merrill
Related topics:
Linux
Related products:
Red Hat Enterprise Linux

Share:

    ISO C++ June 2023 meeting "trip" report (core language)

    The C++ committee had its third hybrid meeting in Varna, Bulgaria this month, to begin work on C++26. This was the first time in this location, after the original plan to host the June 2020 meeting was cancelled. From Red Hat, Jonathan Wakely was there in person, while I attended virtually, from seven time zones behind. As usual, I spent most of my time in the Core working group.

    New C++26 features

    We moved a few new language features at the meeting:

    P2738, constexpr cast from void*

    Enabling type erasure patterns without virtual functions in constant evaluation, e.g.

        class Doer {
         private:
          const void *ob;
          int (*fn)(const void *);
         public:
          template <typename T>
          constexpr Doer(const T &t)
    	    : ob{&t},
    	      fn{[](const void *p) { return static_cast(p)->doit(); }}
          {}
          constexpr int operator()() const { return fn(ob); }
        };
        struct Thing { constexpr int doit() const { return 42; }; };
        static_assert (Doer(Thing())() == 42);
    

    I've already implemented this proposal for GCC 14; it was pretty trivial with the existing constexpr code.

    P2741, user-generated static_assert messages

    Allowing static_assert messages that aren't string literals, e.g.

        constexpr std::string_view str = "Hello";
        static_assert(false, str);
    
    P2169, placeholder variables with no name

    Removing the need to come up with distinct names for variables that only need names to satisfy syntax, e.g.

        int [a, _, b] = f();
        RAIIType _; // ok, another variable named _
        foo(_); // error, ambiguous
    
    P2641, checking if a union member is active

    This was a library motion, but requires compiler support. In constant evaluation, it's useful to be able to ask the compiler whether a particular union member is active. The paper proposes a more general mechanism, std::is_within_lifetime (ptr), which constant evaluation can answer based on knowing what value is currently stored in a particular object. For trivial types, this can already be tested in GCC with __builtin_constant_p (*ptr), but it's not straightforward to do this for a class type.

    P2752, static storage for braced initializers (DR)

    This isn't a new feature, but a clarification that it is OK for a compiler to put a constant initializer-list backing array into static storage even if it can't be sure that its lifetime doesn't overlap with the same one in a recursive call:

        void f(std::initializer_list<int>);
        void g() {
          f({1,2,3}); // the array of 3 ints can now go in .rodata regardless of the definition of f
        }
    

    This standardizes an optimization I already implemented for GCC 14.

    Potential C++26 features

    CWG also discussed various papers that weren't ready for a vote at this meeting, including:

    P1061, Structured Bindings can introduce a pack
        template <class F, class Tuple>
        constexpr decltype(auto) apply(F &&f, Tuple &&t)
        {
    	auto&& [...elems] = t; // elems is a structured binding pack
    	return std::invoke(std::forward<F>(f),
    	    forward_like<Tuple, decltype(elems)>(elems)...);
        }
    

    We saw this paper at the last meeting as well. At this meeting we were working to nail down the specific consequences of allowing this to be used outside of a template, as a use of the name of a structured binding pack in the pattern of a pack expansion is necessarily a dependent name. More work is needed on this.

    P2662, Pack indexing

    For getting at an element of a pack without writing another template.

        template<class ...T>
        int f( T...[0], std::tuple<T...> );
    
    P2795, Erroneous behaviour for uninitialized reads.

    The C++ committee is concerned about safety issues with buggy code in general, and working to limit the impact. This paper wants to address vulnerabilities from variables that are read without being first initialized (CWE-457). It proposes that reading such a variable no longer be undefined behavior, but rather a new category of "erroneous" behavior, which is well-defined but diagnosable: reading an erroneous value can still be rejected by something like valgrind, but it won't give you the value that happened to be at that location before. The GCC -ftrivial-auto-var-init flag implements something similar. Various people on the committee pointed out that sometimes leaving a variable actually uninitialized is important to performance, so there needs to be a way to opt out of the new semantics; discussion of that mechanism is ongoing.

    And then, of course, we spent a good amount of time resolving more subtle issues.

    The C++26 process is off to a strong start; the next meeting will be in November, back in Kona.

    Disclaimer: Please note the content in this blog post has not been thoroughly reviewed by the Red Hat Developer editorial team. Any opinions expressed in this post are the author's own and do not necessarily reflect the policies or positions of Red Hat.

    Related Posts

  • Report from the virtual ISO C++ meetings in 2020 (core language)

  • C++ standardization (core language) progress in 2021

  • ISO C++ Feb 2023 meeting trip report (core language)

  • Why glibc 2.34 removed libpthread

  • New C++ features in GCC 13

  • A leaner <iostream> in libstdc++ for GCC 13

  • Recent Posts

    • How Trilio secures OpenShift virtual machines and containers

    • How to implement observability with Node.js and Llama Stack

    • How to encrypt RHEL images for Azure confidential VMs

    • How to manage RHEL virtual machines with Podman Desktop

    • Speech-to-text with Whisper and Red Hat AI Inference Server

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue