public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/104548] New: parser rejects alias template id of lambda in unevaluated-context and accepts when no alias is used
@ 2022-02-15 11:50 nickhuang99 at hotmail dot com
2022-02-16 1:31 ` [Bug c++/104548] " pinskia at gcc dot gnu.org
2024-04-13 15:15 ` ppalka at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: nickhuang99 at hotmail dot com @ 2022-02-15 11:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104548
Bug ID: 104548
Summary: parser rejects alias template id of lambda in
unevaluated-context and accepts when no alias is used
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: nickhuang99 at hotmail dot com
Target Milestone: ---
I feel this issue is related with PR104537 and PR104358
Parser rejects following code with alias of template id:
https://www.godbolt.org/z/eec3T5ebj
template<typename T>
using FunPtr=decltype(+[](T t)->T{return t+1;});
template<typename T>
auto foo(T t, FunPtr<T> funPtr){
return funPtr(t);
}
void test(){
// parser rejects when using alias
foo<int>(5, [](int t){return t+1;});
}
<source>:14:21: error: invalid user-defined conversion from
'test()::<lambda(int)>' to 'int' [-fpermissive]
14 | foo<int>(5, [](int t){return t+1;});
| ^~~~~~~~~~~~~~~~~~~~~~
And accepts exact same code when NO alias is used:
template<typename T>
auto foo(T t, decltype(+[](T t)->T{return t+1;}) lam){
return lam(t);
}
void test(){
// parser accepts when no alias is used
foo<int>(5, [](int t){return t+1;});
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/104548] parser rejects alias template id of lambda in unevaluated-context and accepts when no alias is used
2022-02-15 11:50 [Bug c++/104548] New: parser rejects alias template id of lambda in unevaluated-context and accepts when no alias is used nickhuang99 at hotmail dot com
@ 2022-02-16 1:31 ` pinskia at gcc dot gnu.org
2024-04-13 15:15 ` ppalka at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-16 1:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104548
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=90533
Status|UNCONFIRMED |NEW
Last reconfirmed| |2022-02-16
Ever confirmed|0 |1
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed, very much related to PR 90533.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/104548] parser rejects alias template id of lambda in unevaluated-context and accepts when no alias is used
2022-02-15 11:50 [Bug c++/104548] New: parser rejects alias template id of lambda in unevaluated-context and accepts when no alias is used nickhuang99 at hotmail dot com
2022-02-16 1:31 ` [Bug c++/104548] " pinskia at gcc dot gnu.org
@ 2024-04-13 15:15 ` ppalka at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-04-13 15:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104548
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Target Milestone|--- |14.0
CC| |ppalka at gcc dot gnu.org
Status|NEW |RESOLVED
--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 14 by the PR114393 fixes.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-04-13 15:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-15 11:50 [Bug c++/104548] New: parser rejects alias template id of lambda in unevaluated-context and accepts when no alias is used nickhuang99 at hotmail dot com
2022-02-16 1:31 ` [Bug c++/104548] " pinskia at gcc dot gnu.org
2024-04-13 15:15 ` 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).