llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Timm Baeder (tbaederr)

<details>
<summary>Changes</summary>

They always have a base and need the note emitted so HasConstantInitialization 
of the variable is false.

---
Full diff: https://github.com/llvm/llvm-project/pull/235616.diff


2 Files Affected:

- (modified) clang/lib/AST/ByteCode/Interp.cpp (+1-1) 
- (modified) clang/test/AST/ByteCode/ms.cpp (+11-5) 


``````````diff
diff --git a/clang/lib/AST/ByteCode/Interp.cpp 
b/clang/lib/AST/ByteCode/Interp.cpp
index 02beb38b7e2c65..4d3ee95df216c0 100644
--- a/clang/lib/AST/ByteCode/Interp.cpp
+++ b/clang/lib/AST/ByteCode/Interp.cpp
@@ -2998,7 +2998,7 @@ bool CheckPointerToIntegralCast(InterpState &S, CodePtr 
OpPC,
   S.CCEDiag(E, diag::note_constexpr_invalid_cast_ptrtoint)
       << diag::ConstexprInvalidCastKind::ThisConversionOrReinterpret
       << S.getLangOpts().CPlusPlus << S.Current->getRange(OpPC);
-  if (Ptr.isBlockPointer() && !Ptr.isZero())
+  if ((Ptr.isBlockPointer() && !Ptr.isZero()) || Ptr.isOpaquePointer())
     S.CCEDiag(E, diag::note_constexpr_has_lvalue) << S.Current->getRange(OpPC);
   if (Ptr.isIntegralPointer())
     return true;
diff --git a/clang/test/AST/ByteCode/ms.cpp b/clang/test/AST/ByteCode/ms.cpp
index 35ffcbccae3b3a..4a77ef4b543f86 100644
--- a/clang/test/AST/ByteCode/ms.cpp
+++ b/clang/test/AST/ByteCode/ms.cpp
@@ -1,8 +1,5 @@
-// RUN: %clang_cc1 -verify=ref,both %s -fms-extensions -fcxx-exceptions
-// RUN: %clang_cc1 -verify=expected,both %s 
-fexperimental-new-constant-interpreter -fms-extensions -fcxx-exceptions
-
-// ref-no-diagnostics
-// expected-no-diagnostics
+// RUN: %clang_cc1 -verify=ref,both      %s                                    
     -fms-compatibility -fms-extensions -fcxx-exceptions
+// RUN: %clang_cc1 -verify=expected,both %s 
-fexperimental-new-constant-interpreter -fms-compatibility -fms-extensions 
-fcxx-exceptions
 
 /// Used to assert because the two parameters to _rotl do not have the same 
type.
 static_assert(_rotl(0x01, 5) == 32);
@@ -19,3 +16,12 @@ constexpr int noopIsActuallyNoop() {
     return a;
 }
 static_assert(noopIsActuallyNoop() == 0);
+
+
+auto foo() {
+  const long bar = (long)&&label; // both-note {{via initialization of 
variable 'bar' here}}
+  return (void *)bar; // both-warning {{returning address of label, which is 
local}}
+label:
+} // both-warning {{C++23 extension}}
+
+

``````````

</details>


https://github.com/llvm/llvm-project/pull/235616
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to