llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

Frontend crash when instantiating an inner-class deduction guide inside a variadic outer template

Open ICSE-27 opened this issue 2 months ago • 3 comments

Environment

Clang 19.1.0 (x86-64-unknown-linux-gnu, release build without assertions)

Command

$ clang++ -c test9.cpp

Actual behavior

The compiler crashes with a stack dump while instantiating the inner class template’s deduction guide (at any optimization level, -O0 through -O3).

Additional notes

The test case was produced by an automated compiler-testing tool (GapSmith).

Test case (test9.cpp)

template <typename... Args>
struct outer {
    template <typename Type>
    struct inner {
        inner(Args...) { }
    };

    inner(Args...) -> inner<int>; 
};

int main() {
    outer();
}

ICSE-27 avatar Sep 26 '26 12:09 ICSE-27

@llvm/issue-subscribers-clang-frontend

Author: ICSE-27

Environment

Clang 19.1.0 (x86-64-unknown-linux-gnu, release build without assertions)

Command

clang++ -c test9.cpp

Actual behavior

The compiler crashes with a stack dump while instantiating the inner class template’s deduction guide (at any optimization level, -O0 through -O3).

Additional notes

The test case was produced by an automated compiler-testing tool (GapSmith).

Test case (test9.cpp)

template &lt;typename... Args&gt;
struct outer {
    template &lt;typename Type&gt;
    struct inner {
        inner(Args...) { }
    };

    inner(Args...) -&gt; inner&lt;int&gt;; 
};

int main() {
    outer();
}

@ICSE-27 You should

  • Report bugs only if they appears with the most recent release. Older releases are not maintained.
  • Provide a godbolt link with assertions build if possible.
  • Check for duplicate before submitting.
  • Tell which version the bug goes back to (which version introduced the bug).
  • Remove useless things, e.g. test6.cpp.

Please update your reports.

zwuis avatar Sep 26 '26 13:09 zwuis

It seems that many of the cases you reported are identical to others. What's the cause?

XChy avatar Sep 26 '26 13:09 XChy