cppfront icon indicating copy to clipboard operation
cppfront copied to clipboard

[BUG] An `in` parameter in a statement scope does not work with CTAD

Open bluetarpmedia opened this issue 11 months ago • 0 comments

Describe the bug CTAD does not appear to work with cpp2::in when using a parameter in a statement scope.

To Reproduce Run cppfront on this code (which is similar to #1002):

main: () -> int = {
    
    m : std::mutex = ();

    (_: std::unique_lock = (m))
    {

    }

    _ = m.native_handle();  // Workaround for bug #968

    return 0;
}

After compiling with clang it results in an error:

main.cpp2:5:32: error: use of class template 'std::unique_lock' requires template arguments
    5 | [[maybe_unused]] cpp2::in<std::unique_lock> unnamed_param_1{m};
      |                                ^

Repro on Godbolt

bluetarpmedia avatar Feb 28 '24 06:02 bluetarpmedia