Ticket #9655: main.cpp

File main.cpp, 366 bytes (added by Raffael Casagrande <raffael@…>, 9 years ago)

A small sample script that doesn't compile with gcc 4.8.2 and clang 3.4

Line 
1#include<boost/variant>
2#include<memory>
3
4struct Visitor : public boost::static_visitor<std::unique_ptr<int>> {
5 template<class T>
6 std::unique_ptr<int> operator()(T& operand) {
7 return std::unique_ptr<int>(new int(5));
8 }
9};
10
11
12int main() {
13 boost::variant<int,double> a = int(5);
14 boost::apply_visitor(Visitor(),a); // this doesn't compile
15}