Open navegador5 opened 1 month ago
FYI : when I copy paste the original-code from char16ptr.h out AND then compile just-it, every thing is OK( no warning ):
class ConstChar16Ptr final {
public:
inline ConstChar16Ptr(const char16_t *p) :p_(p) {};
inline const char16_t *get() const { return p_; };
inline ~ConstChar16Ptr(){
//asm volatile("" : : "rm"(p_) : "memory");
};
private:
ConstChar16Ptr() = delete;
template<typename T> static const char16_t *cast(const T *t) {
//asm volatile("" : : "rm"(t) : "memory");
return reinterpret_cast<const char16_t *>(t);
}
const char16_t *p_;
};
int main() {
{
mcr_shtnm(decltype(u"abc")); //const char16_t(&)[4]
auto* p0 = reinterpret_cast<char*>(const_cast<char16_t*>(ConstChar16Ptr{u"abc"}.get()));
auto* p1 = (char*)(const_cast<char16_t*>(ConstChar16Ptr{u"abc"}.get()));
auto* p2 = (char*)(ConstChar16Ptr{u"abc"}.get());
auto* p3 = reinterpret_cast<const char*>(ConstChar16Ptr{u"abc"}.get());
mcr_shtnm(decltype(p0)); //char*
mcr_shtnm(decltype(p1)); //char*
mcr_shtnm(decltype(p2)); //char*
mcr_shtnm(decltype(p3)); //const char *
}
std::cout << "------------------------" << std::endl;
{
auto* P = u"abc";
auto* p0 = reinterpret_cast<char*>(const_cast<char16_t*>(ConstChar16Ptr{P}.get()));
auto* p1 = (char*)(const_cast<char16_t*>(ConstChar16Ptr{P}.get()));
auto* p2 = (char*)(ConstChar16Ptr{P}.get());
auto* p3 = reinterpret_cast<const char*>(ConstChar16Ptr{P}.get());
mcr_shtnm(decltype(P)); //const char16_t*
mcr_shtnm(decltype(p0)); //char*
mcr_shtnm(decltype(p1)); //char*
mcr_shtnm(decltype(p2)); //char*
mcr_shtnm(decltype(p3)); //const char *
}
}
but when i compile it with all the code in nodejs, the warning appeared(boring...)
Version
Node.js v22.4.1.
Platform
Subsystem
No response
What steps will reproduce the bug?
I just change the
std=gnu++xxxx
INcc_flags
tostd=gnu++23
. others same as default then:How often does it reproduce? Is there a required condition?
always.
What is the expected behavior? Why is that the expected behavior?
no warning
What do you see instead?
Additional information
No response