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

llvm crash - segfault during template argument deduction

Open eddieavd opened this issue 2 years ago • 4 comments

llvm crashes for the following reduced code:

class a {
  using size_type = long;
  template < typename Self > void at( this Self&&, size_type );
};
template < typename > class b : a{};
template < typename T = int > class d : b< T > {
  using some_type = T;

  some_type f = at( f );
};
d i e

if some_type does not depend on T, llvm reports use of underclared identifier 'at', no crash

full preprocessed input reproducing compile command

compiler explorer 1, compiler explorer 2

eddieavd avatar Feb 04 '24 19:02 eddieavd

@llvm/issue-subscribers-clang-frontend

Author: None (eddieavd)

llvm crashes for the following reduced code:
class a {
  using size_type = long;
  template &lt; typename Self &gt; void at( this Self&amp;&amp;, size_type );
};
template &lt; typename &gt; class b : a{};
template &lt; typename T = int &gt; class d : b&lt; T &gt; {
  using some_type = T;

  some_type f = at( f );
};
d i e

if some_type does not depend on T, llvm reports use of underclared identifier 'at', no crash

full preprocessed input reproducing compile command

compiler explorer 1, compiler explorer 2

llvmbot avatar Feb 05 '24 01:02 llvmbot

Looks similar to: https://github.com/llvm/llvm-project/issues/69838

CC @cor3ntin

shafik avatar Feb 05 '24 05:02 shafik

@shafik Looks like it's no longer crashing.

MagentaTreehouse avatar Mar 19 '25 16:03 MagentaTreehouse

@shafik Looks like it's no longer crashing.

It looks like it was fixed in clang-20

shafik avatar Mar 19 '25 18:03 shafik