aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda24.C
blob: 2edb24e41ac357b304f12f9e847682a85e0191d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// PR c++/87327
// { dg-do compile { target c++17 } }

template <int N>
struct Foo {
    constexpr auto size() const {
        return N;
    }
};

constexpr int foo() {
    constexpr auto a = Foo<5>{};

    [&] {
        Foo<a.size()> it = {};

        return it;
    }();

    return 42;
}

constexpr int i = foo();