[all-commits] [llvm/llvm-project] 3b58a6: [clang][bytecode] Allow forming pointers to fields...

Timm Baeder via All-commits all-commits at lists.llvm.org
Thu Apr 24 22:43:54 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3b58a60086cb755fe40cb90a73d27a83d44ce766
      https://github.com/llvm/llvm-project/commit/3b58a60086cb755fe40cb90a73d27a83d44ce766
  Author: Timm Baeder <tbaeder at redhat.com>
  Date:   2025-04-25 (Fri, 25 Apr 2025)

  Changed paths:
    M clang/lib/AST/ByteCode/Interp.cpp
    M clang/test/AST/ByteCode/cxx11.cpp

  Log Message:
  -----------
  [clang][bytecode] Allow forming pointers to fields of extern globals (#137211)

This should be fine as long as we're not reading from it.

Note that this regresses
CXX/special/class.init/class.inhctor.init/p1.cpp, which used to work
fine with the bytecode interpreter.

That's because this code now fails:

```c++
  struct Param;
  struct A {
    constexpr A(Param);
    int a;
  };

  struct B : A { B(); using A::A; int b = 2; };
  struct Wrap1 : B { constexpr Wrap1(); };
  struct Wrap2 : Wrap1 {};
  extern const Wrap2 b;

  struct Param {
    constexpr Param(int c) : n(4 * b.a + b.b + c) {}
    int n;
  };
```
and reports that the Param() constructor is never a valid constant
expression. But that's true and the current interpeter should report
that as well. It also fails when calling at compile time.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list