I noticed we didn't have a hint for std::byte yet.

Tested x86_64-pc-linux-gnu, applying to trunk.

---
 gcc/cp/name-lookup.c                                | 2 ++
 gcc/testsuite/g++.dg/lookup/missing-std-include-9.C | 3 +++
 2 files changed, 5 insertions(+)
 create mode 100644 gcc/testsuite/g++.dg/lookup/missing-std-include-9.C

diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index e64cd9a9d66..181dad0e2f2 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -5641,6 +5641,8 @@ get_std_name_hint (const char *name)
     /* <condition_variable>. */
     {"condition_variable", "<condition_variable>", cxx11},
     {"condition_variable_any", "<condition_variable>", cxx11},
+    /* <cstddef>.  */
+    {"byte", "<cstddef>", cxx17},
     /* <deque>.  */
     {"deque", "<deque>", cxx98},
     /* <forward_list>.  */
diff --git a/gcc/testsuite/g++.dg/lookup/missing-std-include-9.C 
b/gcc/testsuite/g++.dg/lookup/missing-std-include-9.C
new file mode 100644
index 00000000000..f8e1e1dd8a7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lookup/missing-std-include-9.C
@@ -0,0 +1,3 @@
+std::byte b;            // { dg-error "byte" }
+// { dg-message "cstddef" "" { target c++17 } .-1 }
+// { dg-message "C..17" "" { target c++14_down } .-2 }

base-commit: ada5a6defe4bb8a68098bed51d0f22fc78d7efbc
-- 
2.18.1

Reply via email to