summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2023-11-09 23:27:03 +0100
committerGitHub <noreply@github.com>2023-11-09 14:27:03 -0800
commitaf93434115800f5b7d85eb81cb774db287f1b3b7 (patch)
tree37f76f9b8ea273a24c7045ed33facbfdc812c812 /CMakeLists.txt
parentb289577d596bc23e9285e12661e96149a29edb6c (diff)
downloadbinaryen-af93434115800f5b7d85eb81cb774db287f1b3b7.tar.gz
binaryen-af93434115800f5b7d85eb81cb774db287f1b3b7.tar.bz2
binaryen-af93434115800f5b7d85eb81cb774db287f1b3b7.zip
[NFC] Add explicit deduction guides for CTAD (#6094)
Class template argument deduction (CTAD) is a C++17 feature that allows variables to be declared with class template types without specifying the template parameters. Deduction guides are a mechanism by which template authors can control how the template parameters are inferred when CTAD is used. The Google style guide prohibits the use of CTAD except where template authors opt in to supporting it by providing explicit deduction guides. For compatibility with users adhering to Google style, set the compiler flag to check this condition and add the necessary deduction guides to make the compiler happy again.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt5
1 files changed, 5 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2aefeef05..4727100de 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -280,6 +280,11 @@ else()
add_compile_flag("-Wimplicit-fallthrough")
add_compile_flag("-Wnon-virtual-dtor")
+ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+ # Google style requires this, so make sure we compile cleanly with it.
+ add_compile_flag("-Wctad-maybe-unsupported")
+ endif()
+
if(WIN32)
add_compile_flag("-D_GNU_SOURCE")
add_compile_flag("-D__STDC_FORMAT_MACROS")