-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Open
Labels
c++11c++14clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"diverges-from:gccDoes the clang frontend diverge from gcc on this issueDoes the clang frontend diverge from gcc on this issuegood first issuehttps://github.com/llvm/llvm-project/contributehttps://github.com/llvm/llvm-project/contribute
Description
GCC and Clang disagree on their handling of [[gnu::weak]] before C++17 https://gcc.godbolt.org/z/s7q67vqjz
struct S { static constexpr int var = 0; };
[[gnu::weak]] constexpr int S::var;
static constexpr int usage = S::var;While it would be unsafe to constant-fold this code, it should be fine to constant-evaluate it, for consistency with GCC
In static bool evaluateVarDeclInit (ExprConstant.cpp), and in static bool CheckWeak (Interp.cpp), we should allow constant evaluation -without diagnostics, but not constant folding) - by looking at Info.EvalMode
frederick-vs-ja
Metadata
Metadata
Assignees
Labels
c++11c++14clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"diverges-from:gccDoes the clang frontend diverge from gcc on this issueDoes the clang frontend diverge from gcc on this issuegood first issuehttps://github.com/llvm/llvm-project/contributehttps://github.com/llvm/llvm-project/contribute