llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Samrudh Nelli (SamrudhNelli) <details> <summary>Changes</summary> Add initialization tests for `0.0f`, `0e0`, `0x0p0`. Suggested by @<!-- -->shafik in #<!-- -->180376 --- Full diff: https://github.com/llvm/llvm-project/pull/181965.diff 2 Files Affected: - (modified) clang/test/AST/ByteCode/constexpr.c (+6) - (modified) clang/test/Sema/constexpr.c (+6) ``````````diff diff --git a/clang/test/AST/ByteCode/constexpr.c b/clang/test/AST/ByteCode/constexpr.c index dfe3d667f27cc..b345d5e67aa43 100644 --- a/clang/test/AST/ByteCode/constexpr.c +++ b/clang/test/AST/ByteCode/constexpr.c @@ -313,6 +313,12 @@ constexpr int *V84 = 42; constexpr int *V85 = nullptr; constexpr int *V91 = 0.; // both-error@-1 {{initializing 'int *const' with an expression of incompatible type 'double'}} +constexpr int *V92 = 0.0f; +// both-error@-1 {{initializing 'int *const' with an expression of incompatible type 'float'}} +constexpr int *V93 = 0e0; +// both-error@-1 {{initializing 'int *const' with an expression of incompatible type 'double'}} +constexpr int *V94 = 0x0p0; +// both-error@-1 {{initializing 'int *const' with an expression of incompatible type 'double'}} // Check that constexpr variables should not be VLAs. void f6(const int P1) { diff --git a/clang/test/Sema/constexpr.c b/clang/test/Sema/constexpr.c index 04da0f56a741d..3a6b49fd90748 100644 --- a/clang/test/Sema/constexpr.c +++ b/clang/test/Sema/constexpr.c @@ -313,6 +313,12 @@ constexpr int *V84 = 42; constexpr int *V85 = nullptr; constexpr int *V91 = 0.0; // expected-error@-1 {{initializing 'int *const' with an expression of incompatible type 'double'}} +constexpr int *V92 = 0.0f; +// expected-error@-1 {{initializing 'int *const' with an expression of incompatible type 'float'}} +constexpr int *V93 = 0e0; +// expected-error@-1 {{initializing 'int *const' with an expression of incompatible type 'double'}} +constexpr int *V94 = 0x0p0; +// expected-error@-1 {{initializing 'int *const' with an expression of incompatible type 'double'}} // Check that constexpr variables should not be VLAs. void f6(const int P1) { `````````` </details> https://github.com/llvm/llvm-project/pull/181965 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
