Issue 151468
Summary [Clang] Clang and GCC diverge on parsing `new (std::nothrow_t())`
Labels clang
Assignees
Reporter Xniao
    ## Description:
I'm seeking clarification on whether the following code is well-formed C++.  
GCC accepts it, but Clang rejects it with:  
`error: cannot allocate function type 'std::nothrow_t ()' with new`

## Program
```cpp
#include <new>

int main() {
    char* p = new (std::nothrow_t()) char[1];
    return 0;
}
```

Is this a parsing difference, or is one compiler incorrect?
Repro: https://godbolt.org/z/17zfedxds
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to