[pushed] c++: don't advertise C++20 concepts in C++14

Message ID 20241001214018.600327-1-jason@redhat.com
State Committed
Commit 1c9b440bf6768c1053101c4a473f5fc9757f52a5
Headers
Series [pushed] c++: don't advertise C++20 concepts in C++14 |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 warning Patch is already merged
linaro-tcwg-bot/tcwg_gcc_build--master-arm warning Patch is already merged

Commit Message

Jason Merrill Oct. 1, 2024, 9:39 p.m. UTC
  Tested x86_64-pc-linux-gnu, applying to trunk.

-- 8< --

There have been various problems with -std=c++14 -fconcepts; let's stop
defining the feature test macro in that case.

gcc/c-family/ChangeLog:

	* c-cppbuiltin.cc (c_cpp_builtins): Don't define __cpp_concepts
	before C++17.
---
 gcc/c-family/c-cppbuiltin.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


base-commit: 1b7cfa715c6c02db6ef587c87757d7792fc43423
  

Patch

diff --git a/gcc/c-family/c-cppbuiltin.cc b/gcc/c-family/c-cppbuiltin.cc
index 73a07055a86..b37a4c09792 100644
--- a/gcc/c-family/c-cppbuiltin.cc
+++ b/gcc/c-family/c-cppbuiltin.cc
@@ -1102,7 +1102,7 @@  c_cpp_builtins (cpp_reader *pfile)
 	  cpp_define (pfile, "__cpp_deleted_function=202403L");
 	  cpp_define (pfile, "__cpp_variadic_friend=202403L");
 	}
-      if (flag_concepts)
+      if (flag_concepts && cxx_dialect > cxx14)
 	cpp_define (pfile, "__cpp_concepts=202002L");
       if (flag_contracts)
 	{