Skip to content

<memory>: std::construct_at(s, " ") did not evaluate to a constant #2467

@hewillk

Description

@hewillk
#include<string>
#include<memory>

constexpr bool b = [] {
  std::string s[1];
  std::construct_at(s, " ");
  return true;
}();

https://godbolt.org/z/jdx7oGnMn

MSVC-trunk rejects it with:

<source>(4): error C2131: expression did not evaluate to a constant
<source>(6): note: a non-constant (sub-)expression was encountered

I don't know if this is a language bug or a library bug, please correct me if I'm missing something.

Metadata

Metadata

Assignees

No one assigned

    Labels

    compilerCompiler work involvedexternalThis issue is unrelated to the STL

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions