Skip to content

Volatile is deprecated in C++20 #1193

Closed
@Troels51

Description

@Troels51

Describe the bug
In C++20 a lot of the volatile keyword is being deprecated (P1152R3)
For example deallocate has this problem

To Reproduce
Steps to reproduce the behavior:

  1. Use a new compiler, fx gcc10
  2. Set CMAKE_CXX_STANDARD to 20
  3. Build

Expected behavior
Expected the build to complete

Desktop (please complete the following information):

  • gcc version 10.1.0

Additional context
I ran into this problem because i am using jsoncpp in a project that was setting CXX_STANDARD to 20, and then when we upgraded gcc we were getting compile errors.
For example

jsoncpp-src/include/json/allocator.h:41:36: error: ‘volatile’-qualified parameter is deprecated [-Werror=volatile]
   41 |   void deallocate(volatile pointer p, size_type n) {
      |                   ~~~~~~~~~~~~~~~~~^

Metadata

Metadata

Assignees

No one assigned

    Labels

    Language ConformanceC++11, style, or language warning topics addressed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions