public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98077] New: C++ 17: Using alias template bug in gcc
@ 2020-12-01 7:15 juergen.reiss at gmx dot de
2020-12-01 10:33 ` [Bug c++/98077] " redi at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: juergen.reiss at gmx dot de @ 2020-12-01 7:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98077
Bug ID: 98077
Summary: C++ 17: Using alias template bug in gcc
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: juergen.reiss at gmx dot de
Target Milestone: ---
The error was reported here:
https://stackoverflow.com/questions/65079471/c-17-using-alias-template-bug-in-gcc
A demo is here: https://godbolt.org/z/avGv3n
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/98077] C++ 17: Using alias template bug in gcc
2020-12-01 7:15 [Bug c++/98077] New: C++ 17: Using alias template bug in gcc juergen.reiss at gmx dot de
@ 2020-12-01 10:33 ` redi at gcc dot gnu.org
2020-12-01 13:11 ` redi at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2020-12-01 10:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98077
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
Last reconfirmed| |2020-12-01
Ever confirmed|0 |1
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Please see https://gcc.gnu.org/bugs for the requested info.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/98077] C++ 17: Using alias template bug in gcc
2020-12-01 7:15 [Bug c++/98077] New: C++ 17: Using alias template bug in gcc juergen.reiss at gmx dot de
2020-12-01 10:33 ` [Bug c++/98077] " redi at gcc dot gnu.org
@ 2020-12-01 13:11 ` redi at gcc dot gnu.org
2020-12-01 13:15 ` redi at gcc dot gnu.org
2021-06-24 19:25 ` ppalka at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2020-12-01 13:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98077
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |NEW
Keywords| |rejects-valid
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The testcase from the godbolt link is:
// { dg-options "-std=gnu++17" }
#include <functional>
template <typename T>
struct CallableTrait;
template <typename R, typename... Args>
struct CallableTrait<std::function<R(Args...)>>
{
using ReturnType = R;
};
template <typename Callable>
using CallableTraitT =
CallableTrait<decltype(std::function{std::declval<Callable>()})>;
template <typename Callable>
auto test(Callable&&)
{
using CallableInfo = CallableTraitT<Callable>;
static_assert(!std::is_void_v<typename CallableInfo::ReturnType>);
}
int main()
{
test([]() { return 42; });
}
It requires at least C++17.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/98077] C++ 17: Using alias template bug in gcc
2020-12-01 7:15 [Bug c++/98077] New: C++ 17: Using alias template bug in gcc juergen.reiss at gmx dot de
2020-12-01 10:33 ` [Bug c++/98077] " redi at gcc dot gnu.org
2020-12-01 13:11 ` redi at gcc dot gnu.org
@ 2020-12-01 13:15 ` redi at gcc dot gnu.org
2021-06-24 19:25 ` ppalka at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2020-12-01 13:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98077
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Reduced:
template<typename T> T&& declval();
template<typename R> struct function
{
template<typename T> function(T) { }
};
template<typename T> function(T) -> function<decltype(declval<T>()())>;
template<typename T> constexpr bool is_void_v = false;
template<> constexpr bool is_void_v<void> = true;
template <typename T>
struct CallableTrait;
template <typename R>
struct CallableTrait<function<R>>
{
using ReturnType = R;
};
template <typename Callable>
using CallableTraitT = CallableTrait<decltype(function{declval<Callable>()})>;
template <typename Callable>
auto test(Callable&&)
{
using CallableInfo = CallableTraitT<Callable>;
static_assert(!is_void_v<typename CallableInfo::ReturnType>);
}
int main()
{
test([]() { return 42; });
}
98077.C: In instantiation of ‘auto test(Callable&&) [with Callable =
main()::<lambda()>]’:
98077.C:34:29: required from here
98077.C:29:20: error: invalid use of incomplete type ‘struct
CallableTrait<main()::<lambda()> >’
29 | static_assert(!is_void_v<typename CallableInfo::ReturnType>);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
98077.C:14:8: note: declaration of ‘struct CallableTrait<main()::<lambda()> >’
14 | struct CallableTrait;
| ^~~~~~~~~~~~~
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/98077] C++ 17: Using alias template bug in gcc
2020-12-01 7:15 [Bug c++/98077] New: C++ 17: Using alias template bug in gcc juergen.reiss at gmx dot de
` (2 preceding siblings ...)
2020-12-01 13:15 ` redi at gcc dot gnu.org
@ 2021-06-24 19:25 ` ppalka at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-06-24 19:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98077
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ppalka at gcc dot gnu.org
Status|NEW |RESOLVED
Resolution|--- |DUPLICATE
--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
This is essentially a dup of the older 91911, I think
*** This bug has been marked as a duplicate of bug 91911 ***
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-06-24 19:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-01 7:15 [Bug c++/98077] New: C++ 17: Using alias template bug in gcc juergen.reiss at gmx dot de
2020-12-01 10:33 ` [Bug c++/98077] " redi at gcc dot gnu.org
2020-12-01 13:11 ` redi at gcc dot gnu.org
2020-12-01 13:15 ` redi at gcc dot gnu.org
2021-06-24 19:25 ` ppalka at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).