public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/105236] New: failed lookup of alias with alias template of dependent template parameter containing lambda in unevaluated context
@ 2022-04-12  6:01 cooky.ykooc922 at gmail dot com
  2022-04-12  7:59 ` [Bug c++/105236] " jakub at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: cooky.ykooc922 at gmail dot com @ 2022-04-12  6:01 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105236
           Summary: failed lookup of alias with alias template of
                    dependent template parameter containing lambda in
                    unevaluated context
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cooky.ykooc922 at gmail dot com
  Target Milestone: ---

Code:

/// test_alias
template <typename F>
using test_alias = decltype([]{ return F{}; }());

/// test_temp
template <typename F>
struct test_temp {
    using type = decltype([]{ return F{}; }());
};

struct Custom {};

/// test
template <typename F>
void test() {
    // does not produce error in 'test_alias<Custom>'
    using return_type = test_alias<F>;
    return_type result;

    // compiles fine with:
    // 'test_alias<F> result;'
}

Expected Behavior:
this should compile with no compilation error same as other compilers such as
Clang, and MSVC

Compilation Error Message:
<source>: In function 'void test()':
<source>:L:C: error: 'return_type' was not declared in this scope
   18 |     return_type result;

Other workaround (with no compilation error):

template <typename F>
void test0() {
    using return_type = test_temp<F>::type;
    return_type result;
}

GCC Version: 12 (trunk)
Additional Command Line: -std=c++20

Compiler Explorer Link: https://godbolt.org/z/TKWxfKjnY

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-04-13  8:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-12  6:01 [Bug c++/105236] New: failed lookup of alias with alias template of dependent template parameter containing lambda in unevaluated context cooky.ykooc922 at gmail dot com
2022-04-12  7:59 ` [Bug c++/105236] " jakub at gcc dot gnu.org
2022-11-08 23:20 ` pinskia at gcc dot gnu.org
2024-04-13  8:05 ` pinskia 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).