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

--- Comment #3 from Aakash Gupta <uchanahome8 at gmail dot com> ---
My bad... didn't realize that by default gcc runs in C++20 mode.

I was experimenting with the following in my local project and mistakenly
thought that `using MyType` is the issue (https://godbolt.org/z/r9a48Wa3s):


```
template <typename T>
using MyType = [: [] {
    if constexpr (std::same_as<T, bool>)
        return ^^bool;
    else if constexpr (std::is_integral_v<T>)
        return ^^std::int64_t;
    else
        return ^^std::string;
}() :];
```

Error:
```
<source>: In lambda function:
<source>:12:18: error: '^^' cannot be applied to a using-declaration
[-Wtemplate-body]
   12 |         return ^^std::int64_t;
      |                  ^~~
ASM generation compiler returned: 1
<source>: In lambda function:
<source>:12:18: error: '^^' cannot be applied to a using-declaration
[-Wtemplate-body]
   12 |         return ^^std::int64_t;
      |                  ^~~
Execution build compiler returned: 1
```

I am unable to decipher why this is failing. The following works:
```
using Alias = int;
static_assert(^^int != ^^Alias);
typedef int Alias2;
static_assert(^^int != ^^Alias2);
```

but this throws compiler error:
```
[:^^std::int64_t:] x = 44;
```

Reply via email to