https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122875

--- Comment #7 from Boris Staletic <boris.staletic at protonmail dot com> ---
(In reply to Marek Polacek from comment #6)
> (In reply to Andrew Pinski from comment #5)
> > (In reply to eczbek.void from comment #1)
> > > This might also be related: https://godbolt.org/z/xxsrz1ozY
> > > 
> > > ```
> > > template<int>
> > > constexpr bool x = true;
> > > 
> > > template<int>
> > > concept test = [:substitute(^^x, {}):];
> > > ```
> > > 
> > > ```
> > > <source>:7:37: internal compiler error: in cp_parser_splice_expression, at
> > > cp/parser.cc:6166
> > 
> > This still happens on the trunk.
> 
> I don't see this; I get:
> 
> 122875.C:5:18: error: there are no arguments to ‘substitute’ that depend on
> a template parameter, so a declaration of ‘substitute’ must be available
> [-fpermissive]
>     5 | concept test = [:substitute(^^x, {}):];


The original test case is missing #include <meta>

Adding that, it fails to compile because of the following can_substitute:

```
#include <meta>
template<typename>
constexpr bool x = true;

struct A {};
struct B : A {};
static_assert(can_substitute(^^x, bases_of(^^B,
std::meta::access_context::current())));
```

The actual error (not an ICE):

```
foo.cpp:10:29: error: non-constant condition for static assertion
   10 | static_assert(can_substitute(^^x, bases_of(^^B,
std::meta::access_context::current())));
      |              
~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
foo.cpp:10:29: error: uncaught exception of type ‘std::meta::exception’;
‘what()’: ‘invalid argument to can_substitute’
```

Using `{^^A}` instead of `basses_of(^^B, ...)` does compile.

#c3 still ICEs, so that's definitely a different problem.

Reply via email to