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

            Bug ID: 100091
           Summary: decltype([]{}) rejected as a default template
                    parameter
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pilarlatiesa at gmail dot com
  Target Milestone: ---

This piece of code is accepted by 10.2, but rejected by yesterday's (20210414)
snapshot:

$ cat test.cpp

  template<typename = decltype([]{})>
  void f() {}

$ ../GCC-11/bin/g++ -std=c++20 -c test.cpp

test.cpp:2:30: error: lambda-expression in template parameter type
    2 | template<typename = decltype([]{})>
      |

It's a recent change in behaviour. Possibly caused by
r11-8166-ge1666ebd9ad31dbd8b9b933c883bdd882cfd1522.

I'm labeling this as rejects-valid because I believe [basic.def.odr]/14 allows
such an use of a lambda, but I hardly understand that wording.

Reply via email to