ID 5788320
Пользователь Василяка Дарья Романовна
Время 23:43<< 16.11.2021 23:43 (27 д. 21:44)
Обработка 23:43 ... 23:43 (3,60 сек.)
Файл 5788320.cpp (CLang++ 5.0.0 + Address Sanitizer)
Турнир 2 курс. Программирование на C++. Турнир 2, осень 2021
Задача C: Smart Pointer
Набор тестов
Ограничения Время: 25с Память: 512Мб
Состояние  [?]
CE Ошибка компиляции
код | результаты
In file included from Test_SmartPointer.hpp:3:0,
                 from main.cpp:3:
SmartPointer.hpp:4:7: error: redefinition of 'class exception'
 class exception : std::exception {
       ^~~~~~~~~
In file included from main.cpp:2:0:
SmartPointer.hpp:4:7: note: previous definition of 'class exception'
 class exception : std::exception {
       ^~~~~~~~~
In file included from Test_SmartPointer.hpp:3:0,
                 from main.cpp:3:
SmartPointer.hpp:10:7: error: redefinition of 'class SmartPointer<T, Allocator>'
 class SmartPointer {
       ^~~~~~~~~~~~
In file included from main.cpp:2:0:
SmartPointer.hpp:10:7: note: previous definition of 'class SmartPointer<T, Allocator>'
 class SmartPointer {
       ^~~~~~~~~~~~
In file included from main.cpp:3:0:
Test_SmartPointer.hpp:10:17: error: 'smart_pointer' is not a namespace-name
 using namespace smart_pointer;
                 ^~~~~~~~~~~~~
Test_SmartPointer.hpp:10:30: error: expected namespace-name before ';' token
 using namespace smart_pointer;
                              ^
In file included from SmartPointer.hpp:2:0,
                 from main.cpp:2:
Test_SmartPointer.hpp: In function 'void test::test(const string&) [with __TEST_CLASSNAME__ = SmartPointer<float, std::allocator<float> >; std::__cxx11::string = std::__cxx11::basic_string<char>]':
Test_SmartPointer.hpp:233:44: error: 'smart_pointer' does not name a type; did you mean 'SmartPointer'?
         CHECK_THROW_WITH_TYPE_TRAIT(*sptr, smart_pointer::exception);
                                            ^
Test.hpp:61:13: note: in definition of macro 'CHECK_THROW_WITH_TYPE_TRAIT'
     } catch(EXCEPTION_TYPE& ex) { \
             ^~~~~~~~~~~~~~
Test.hpp:61:27: error: expected unqualified-id before '&' token
     } catch(EXCEPTION_TYPE& ex) { \
                           ^
Test_SmartPointer.hpp:233:9: note: in expansion of macro 'CHECK_THROW_WITH_TYPE_TRAIT'
         CHECK_THROW_WITH_TYPE_TRAIT(*sptr, smart_pointer::exception);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Test.hpp:61:27: error: expected ')' before '&' token
     } catch(EXCEPTION_TYPE& ex) { \
                           ^
Test_SmartPointer.hpp:233:9: note: in expansion of macro 'CHECK_THROW_WITH_TYPE_TRAIT'
         CHECK_THROW_WITH_TYPE_TRAIT(*sptr, smart_pointer::exception);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Test.hpp:61:27: error: expected '{' before '&' token
     } catch(EXCEPTION_TYPE& ex) { \
                           ^
Test_SmartPointer.hpp:233:9: note: in expansion of macro 'CHECK_THROW_WITH_TYPE_TRAIT'
         CHECK_THROW_WITH_TYPE_TRAIT(*sptr, smart_pointer::exception);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Test.hpp:61:29: error: 'ex' was not declared in this scope
     } catch(EXCEPTION_TYPE& ex) { \
                             ^
Test_SmartPointer.hpp:233:9: note: in expansion of macro 'CHECK_THROW_WITH_TYPE_TRAIT'
         CHECK_THROW_WITH_TYPE_TRAIT(*sptr, smart_pointer::exception);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Test.hpp:61:29: note: suggested alternative: 'exp'
     } catch(EXCEPTION_TYPE& ex) { \
                             ^
Test_SmartPointer.hpp:233:9: note: in expansion of macro 'CHECK_THROW_WITH_TYPE_TRAIT'
         CHECK_THROW_WITH_TYPE_TRAIT(*sptr, smart_pointer::exception);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Test.hpp:64:7: error: expected primary-expression before 'catch'
     } catch(...) { \
       ^
Test_SmartPointer.hpp:233:9: note: in expansion of macro 'CHECK_THROW_WITH_TYPE_TRAIT'
         CHECK_THROW_WITH_TYPE_TRAIT(*sptr, smart_pointer::exception);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Test_SmartPointer.hpp:238:81: error: 'smart_pointer' does not name a type; did you mean 'SmartPointer'?
         CHECK_THROW_WITH_TYPE_TRAIT(*sptr = SmartPointer__type_t::value_type(), smart_pointer::exception);
                                                                                 ^
Test.hpp:61:13: note: in definition of macro 'CHECK_THROW_WITH_TYPE_TRAIT'
     } catch(EXCEPTION_TYPE& ex) { \
             ^~~~~~~~~~~~~~
Test.hpp:61:27: error: expected unqualified-id before '&' token
     } catch(EXCEPTION_TYPE& ex) { \
                           ^
Test_SmartPointer.hpp:238:9: note: in expansion of macro 'CHECK_THROW_WITH_TYPE_TRAIT'
         CHECK_THROW_WITH_TYPE_TRAIT(*sptr = SmartPointer__type_t::value_type(), smart_pointer::exception);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Test.hpp:61:27: error: expected ')' before '&' token
     } catch(EXCEPTION_TYPE& ex) { \
                           ^
Test_SmartPointer.hpp:238:9: note: in expansion of macro 'CHECK_THROW_WITH_TYPE_TRAIT'
         CHECK_THROW_WITH_TYPE_TRAIT(*sptr = SmartPointer__type_t::value_type(), smart_pointer::exception);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Test.hpp:61:27: error: expected '{' before '&' token
     } catch(EXCEPTION_TYPE& ex) { \
                           ^
Test_SmartPointer.hpp:238:9: note: in expansion of macro 'CHECK_THROW_WITH_TYPE_TRAIT'
         CHECK_THROW_WITH_TYPE_TRAIT(*sptr = SmartPointer__type_t::value_type(), smart_pointer::exception);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Test.hpp:61:29: error: 'ex' was not declared in this scope
     } catch(EXCEPTION_TYPE& ex) { \
                             ^
Test_SmartPointer.hpp:238:9: note: in expansion of macro 'CHECK_THROW_WITH_TYPE_TRAIT'
         CHECK_THROW_WITH_TYPE_TRAIT(*sptr = SmartPointer__type_t::value_type(), smart_pointer::exception);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Test.hpp:61:29: note: suggested alternative: 'exp'
     } catch(EXCEPTION_TYPE& ex) { \
                             ^
Test_SmartPointer.hpp:238:9: note: in expansion of macro 'CHECK_THROW_WITH_TYPE_TRAIT'
         CHECK_THROW_WITH_TYPE_TRAIT(*sptr = SmartPointer__type_t::value_type(), smart_pointer::exception);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Test.hpp:64:7: error: expected primary-expression before 'catch'
     } catch(...) { \
       ^
Test_SmartPointer.hpp:238:9: note: in expansion of macro 'CHECK_THROW_WITH_TYPE_TRAIT'
         CHECK_THROW_WITH_TYPE_TRAIT(*sptr = SmartPointer__type_t::value_type(), smart_pointer::exception);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from main.cpp:2:0:
SmartPointer.hpp: In instantiation of 'SmartPointer<T, Allocator>::SmartPointer(SmartPointer<T, Allocator>::value_type*) [with T = float; Allocator = std::allocator<float>; SmartPointer<T, Allocator>::value_type = float]':
Test_SmartPointer.hpp:103:30:   required from here
SmartPointer.hpp:18:20: error: taking address of temporary [-fpermissive]
             core = &Core(p);
                    ^~~~~~~~
SmartPointer.hpp: In instantiation of 'const value_type& SmartPointer<T, Allocator>::operator*() const [with T = float; Allocator = std::allocator<float>; SmartPointer<T, Allocator>::value_type = float]':
Test_SmartPointer.hpp:233:9:   required from here
SmartPointer.hpp:59:20: error: reference to local variable 'f' returned [-Werror=return-local-addr]
         auto const f = *core->p;
                    ^
SmartPointer.hpp: In instantiation of 'SmartPointer<T, Allocator>::SmartPointer(SmartPointer<T, Allocator>::value_type*) [with T = long unsigned int; Allocator = std::allocator<long unsigned int>; SmartPointer<T, Allocator>::value_type = long unsigned int]':
Test_SmartPointer.hpp:304:38:   required from here
SmartPointer.hpp:18:20: error: taking address of temporary [-fpermissive]
             core = &Core(p);
                    ^~~~~~~~
cc1plus: all warnings being treated as errors
[печатать | |
]
(2 519 b)
0.102s 0.009s 10