Bug 95371 - [10/11 Regression] ICE concepts with template template parameter since r10-3735-gcb57504a55015891
Summary: [10/11 Regression] ICE concepts with template template parameter since r10-37...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 10.1.0
: P3 normal
Target Milestone: 10.2
Assignee: Jason Merrill
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2020-05-27 18:42 UTC by gcc-bugs
Modified: 2020-06-01 19:51 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2020-05-27 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description gcc-bugs 2020-05-27 18:42:26 UTC
Hallo gcc-team,

the following code worked with gcc9, but ICEs with gcc 10.1 and in trunk

```c++
template <typename...>
struct configuration  {
    template <template <typename...> typename query_t>
    static constexpr bool exists() { return true; }

    template <template <typename...> typename query_t>
    void remove() requires(exists<query_t>());
};

int main() {
    configuration<> cfg{};
    cfg.remove<configuration>();
}
```

https://godbolt.org/z/NGU5i9


```
> g++-10 -std=c++2a
<source>: In function 'int main()':
<source>:12:31: internal compiler error: Segmentation fault
   12 |     cfg.remove<configuration>();
      |                               ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1
```
Comment 1 Martin Liška 2020-05-27 19:07:32 UTC
Whoops, it's already reduced.
Comment 2 CVS Commits 2020-05-29 22:19:06 UTC
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:2fb595f8348e164d2f06536ba98322616eeaeeb6

commit r11-734-g2fb595f8348e164d2f06536ba98322616eeaeeb6
Author: Jason Merrill <jason@redhat.com>
Date:   Fri May 29 16:55:52 2020 -0400

    c++: Template template parameter in constraint [PR95371]
    
    any_template_parm_r was assuming that the DECL_TEMPLATE_RESULT of a template
    will have a suitable TEMPLATE_INFO from which we can look at the generic
    arguments for that template.  But that wasn't true for a template template
    parameter; this patch makes it so.
    
    gcc/cp/ChangeLog:
    
            PR c++/95371
            * pt.c (process_template_parm): Set DECL_TEMPLATE_INFO
            on the DECL_TEMPLATE_RESULT.
    
    gcc/testsuite/ChangeLog:
    
            PR c++/95371
            * g++.dg/cpp2a/concepts-ttp1.C: New test.
Comment 3 CVS Commits 2020-05-30 02:11:28 UTC
The releases/gcc-10 branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:c07c745b1ef62f633024824b7e125027f10c969b

commit r10-8211-gc07c745b1ef62f633024824b7e125027f10c969b
Author: Jason Merrill <jason@redhat.com>
Date:   Fri May 29 16:55:52 2020 -0400

    c++: Template template parameter in constraint [PR95371]
    
    gcc/cp/ChangeLog:
    
            PR c++/95371
            * pt.c (process_template_parm): Set DECL_TEMPLATE_INFO
            on the DECL_TEMPLATE_RESULT.
    
    gcc/testsuite/ChangeLog:
    
            PR c++/95371
            * g++.dg/cpp2a/concepts-ttp1.C: New test.
    
    (cherry picked from commit d91b3aea7a5bdfbdaec746af2d62894812e6fd86)
Comment 4 Jason Merrill 2020-06-01 19:51:59 UTC
Fixed for 10.2/11.