Wandbox
SettingsLog
SettingsLog
Language
GitHubLogin
Ran/Viewed Log

Author

anonymous

about 6 years ago

Language

C++

Compiler

gcc 6.3.0

Options
Warnings
Don't Use Boost
C++14
no pedantic

Author

anonymous

about 6 years ago

$ g++ prog.cc -Wall -Wextra -std=c++14
prog.cc: In member function 'double& row_t::operator[](size_t)':
prog.cc:19:37: error: invalid use of array with unspecified bounds
         return v_.get()[i_ * NUM + j];
                                     ^
prog.cc:19:22: error: invalid initialization of non-const reference of type 'double&' from an rvalue of type 'double*'
         return v_.get()[i_ * NUM + j];
                ~~~~~~^~
prog.cc: In member function 'double& data_t::operator()(size_t, size_t)':
prog.cc:41:17: error: no match for 'operator[]' (operand types are 'std::shared_ptr<double []>' and 'size_t {aka long unsigned int}')
         return v[i * NUM + j];
                 ^
In file included from /opt/wandbox/gcc-6.3.0/include/c++/6.3.0/bits/shared_ptr.h:52:0,
                 from /opt/wandbox/gcc-6.3.0/include/c++/6.3.0/memory:82,
                 from prog.cc:2:
/opt/wandbox/gcc-6.3.0/include/c++/6.3.0/bits/shared_ptr_base.h: In instantiation of 'std::__shared_ptr<_Tp, _Lp>::__shared_ptr(_Tp1*, _Deleter) [with _Tp1 = double; _Deleter = std::default_delete<double []>; _Tp = double []; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2u]':
/opt/wandbox/gcc-6.3.0/include/c++/6.3.0/bits/shared_ptr.h:134:37:   required from 'std::shared_ptr<_Tp>::shared_ptr(_Tp1*, _Deleter) [with _Tp1 = double; _Deleter = std::default_delete<double []>; _Tp = double []]'
prog.cc:30:65:   required from here
/opt/wandbox/gcc-6.3.0/include/c++/6.3.0/bits/shared_ptr_base.h:895:37: error: cannot convert 'double*' to 'double (*)[]' in initialization
  : _M_ptr(__p), _M_refcount(__p, __d)
                                     ^
Exit Code:
1