diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2024-07-08 13:43:03 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-08 13:43:03 -0400 |
commit | c22625cb3eaf052e2377881d64640196ff5da3d1 (patch) | |
tree | 1db8b9d5e4fd3dfa24198ed8bb59c6f9597a4bfe /clang/test | |
parent | 03d4332625d13014ac94dcd145f538fbfe4c4d0c (diff) | |
download | llvm-c22625cb3eaf052e2377881d64640196ff5da3d1.zip llvm-c22625cb3eaf052e2377881d64640196ff5da3d1.tar.gz llvm-c22625cb3eaf052e2377881d64640196ff5da3d1.tar.bz2 |
[C2y] Remove support for _Imaginary (#97436)
WG14 N3274 removed _Imaginary from Annex G. Clang has never fully
supported Annex G or _Imaginary, so removal is pretty trivial for us.
Note, we are keeping _Imaginary as a keyword so that we get better
diagnostic behavior. This is still conforming because _I makes it a
reserved identifier, so it's not available for users to use as an
identifier anyway.
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/C/C2y/n3274.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/test/C/C2y/n3274.c b/clang/test/C/C2y/n3274.c new file mode 100644 index 0000000..ccdb89f --- /dev/null +++ b/clang/test/C/C2y/n3274.c @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -verify -std=c23 -Wall -pedantic %s
+// RUN: %clang_cc1 -verify -std=c2y -Wall -pedantic %s
+
+/* WG14 N3274: Yes
+ * Remove imaginary types
+ */
+
+// Clang has never supported _Imaginary.
+#ifdef __STDC_IEC_559_COMPLEX__
+#error "When did this happen?"
+#endif
+
+_Imaginary float i; // expected-error {{imaginary types are not supported}}
+
+// _Imaginary is a keyword in older language modes, but doesn't need to be one
+// in C2y or later. However, to improve diagnostic behavior, we retain it as a
+// keyword in all language modes -- it is not available as an identifier.
+static_assert(!__is_identifier(_Imaginary));
|