Issue 58166
Summary Enable #if 0'ed out generic-lamba.cpp test
Labels new issue
Assignees
Reporter erichkeane
    I discovered that generic-lambda.cpp has a bunch of the test `#if 0`'ed out because it crashes.  The test reduces down to:

``` 
  template<class T1> auto outer_func() {
 
    return []<class T2>(T2) {
      struct S {
        static auto f() {
          return 5;
        }
      };
    };
  };
  template auto t2<int>();
```


The assertion hit (https://github.com/llvm/llvm-project/blob/main/clang/lib/Sema/SemaStmt.cpp#L3803) is `assert(AT->isDeduced() && "should have deduced to dependent type");`.`

This happens while instantiating `f` to create the return type of `outer_func`.  The lambda is still dependent, since `outer_func` is returning this dependent lambda, therefore `f` is still in a dependent context.  However, `f`s' return type is still undeduced-auto (note that the reproducer originally has another generic lambda there!).

We SHOULD be instantiating the return type of `outer_func` as the generic lambda, containing the struct, and I would expect it to be ok to have an undeduced `f` return type because of that, but I'm not positive.  At one point, someone needs to spend more time on this than I have to spend.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to