File: default_constructor.cpp

package info (click to toggle)
mapbox-variant 1.2.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,644 kB
  • sloc: cpp: 31,068; ansic: 959; python: 424; makefile: 144; objc: 59; sh: 36
file content (21 lines) | stat: -rw-r--r-- 452 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// @EXPECTED: First type in variant must be default constructible to allow default construction of variant

#include <mapbox/variant.hpp>

// Checks that the first type in a variant must be default constructible to
// make the variant default constructible.

struct no_def_constructor
{

    int value;

    no_def_constructor() = delete;

    no_def_constructor(int v) : value(v) {}
};

int main()
{
    mapbox::util::variant<no_def_constructor> x;
}