Issue 203372
Summary [clang++] deprecation warnings for unused constexpr branch
Labels clang
Assignees
Reporter laverdet
    I was hoping to move away from preprocessor macros because they make my life more complicated with modules. It seems to be a nonstarter if I want my project to compile against multiple versions of the same external library which goes through a lot of churn.

```
$ cat a.cc 
[[deprecated]] auto foo() -> void;
auto foo(int) -> void;

auto main() -> int {
  constexpr auto new_foo = true;
  if constexpr (new_foo) {
    foo(1);
  } else {
 foo();
  }
  return 0;
}
```

```
$ clang++ a.cc -c  
a.cc:9:3: warning: 'foo' is deprecated [-Wdeprecated-declarations]
    9 | foo();
      |                 ^
a.cc:1:3: note: 'foo' has been explicitly marked deprecated here
    1 | [[deprecated]] auto foo() -> void;
      |   ^
1 warning generated.
```

```
$ clang++ --version
Homebrew clang version 22.1.7
Target: arm64-apple-darwin24.6.0
Thread model: posix
InstalledDir: /opt/homebrew/Cellar/llvm/22.1.7/bin
Configuration file: /Users/marcel/.config/clang/arm64-apple-darwin24.cfg
```

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to