llvm / llvm/llvm-project

std::scoped_lock and warning ctad-maybe-unsupported

Open
#211,547 3 comments 0 reactions 0 assignees View on GitHub
clang:diagnostics
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

`std::scoped_lock` supports CTAD by design, yet clang complains that it might not be the case

```c++
#include

void foo(){
std::mutex m;
std::scoped_lock lock( m );
}
```

Example on godbolt: https://compiler-explorer.com/z/von4463eK

Since `std::scoped_lock` comes from the standard library, I cannot add deduction guides to make clang happy, I would expect clang to "know" that `std::scoped_lock lock( m );` is not problematic (if it compiles), no matter from which standard library it comes.

Contributor guide

Open the contributing guide

Research direction

Reproduce the warning from the supplied C++ snippet, using the Compiler Explorer example as the first reference. Locate the implementation and tests for the `ctad-maybe-unsupported` diagnostic, then verify that this `std::scoped_lock` case no longer produces the warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.