Issue 63903
Summary Invalid SourceLocation used for default member initializers in Parenthesized initialization
Labels c++20, clang:frontend
Assignees
Reporter cor3ntin
    ```cpp

#include <source_location>

struct S {
    int _;
    int i = std::source_location::current().line();
};

static_assert(S(0).i == S{0}.i);

```

https://compiler-explorer.com/z/5TnMjYEGr


The assert fails because `BuildCXXDefaultInitExpr` gets the wrong source location in the case of a paren init.
To be consistent, it should get the location of the right paren.
This affects both `source_location` and diagnostics
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to