ID 5786918
Пользователь Thanks to the CWC partners from the GreenTeaNeko
Время 20:23<< 16.11.2021 20:23 (27 д. 18:24) 20:25>>
Обработка 20:23 ... 20:23 (3,37 сек.)
Файл 5786918.cpp (CLang++ 5.0.0 + Address Sanitizer)
Турнир 2 курс. Программирование на C++. Турнир 2, осень 2021
Задача C: Smart Pointer
Набор тестов
Ограничения Время: 25с Память: 512Мб
Состояние  [?]
CE Ошибка компиляции
код | результаты
In file included from main.cpp:2:0:
SmartPointer.hpp:7:42: error: expected class-name before '{' token
 class FormatVisitor : public BaseVisitor {
                                          ^
SmartPointer.hpp:9:22: error: 'BaseNode' does not name a type
     void Visit(const BaseNode* node) override {
                      ^~~~~~~~
SmartPointer.hpp:13:22: error: 'ClassDeclarationNode' does not name a type
     void Visit(const ClassDeclarationNode* node) override {
                      ^~~~~~~~~~~~~~~~~~~~
SmartPointer.hpp:13:10: error: 'void FormatVisitor::Visit(const int*)' cannot be overloaded
     void Visit(const ClassDeclarationNode* node) override {
          ^~~~~
SmartPointer.hpp:9:10: error: with 'void FormatVisitor::Visit(const int*)'
     void Visit(const BaseNode* node) override {
          ^~~~~
SmartPointer.hpp:42:22: error: 'VarDeclarationNode' does not name a type
     void Visit(const VarDeclarationNode* node) override {
                      ^~~~~~~~~~~~~~~~~~
SmartPointer.hpp:42:10: error: 'void FormatVisitor::Visit(const int*)' cannot be overloaded
     void Visit(const VarDeclarationNode* node) override {
          ^~~~~
SmartPointer.hpp:9:10: error: with 'void FormatVisitor::Visit(const int*)'
     void Visit(const BaseNode* node) override {
          ^~~~~
SmartPointer.hpp:53:22: error: 'MethodDeclarationNode' does not name a type
     void Visit(const MethodDeclarationNode* node) override {
                      ^~~~~~~~~~~~~~~~~~~~~
SmartPointer.hpp:53:10: error: 'void FormatVisitor::Visit(const int*)' cannot be overloaded
     void Visit(const MethodDeclarationNode* node) override {
          ^~~~~
SmartPointer.hpp:9:10: error: with 'void FormatVisitor::Visit(const int*)'
     void Visit(const BaseNode* node) override {
          ^~~~~
SmartPointer.hpp:62:11: error: 'std::__cxx11::string {aka std::__cxx11::basic_string<char>}' is not a template
     const string<string>& GetFormattedCode() const {
           ^~~~~~
SmartPointer.hpp:67:5: error: 'std::__cxx11::string {aka std::__cxx11::basic_string<char>}' is not a template
     string<string> v;
     ^~~~~~
SmartPointer.hpp:79:19: error: 'std::__cxx11::string {aka std::__cxx11::basic_string<char>}' is not a template
     void visiting(string<BaseNode*> z) {
                   ^~~~~~
SmartPointer.hpp:79:26: error: 'BaseNode' was not declared in this scope
     void visiting(string<BaseNode*> z) {
                          ^~~~~~~~
SmartPointer.hpp:79:35: error: expected primary-expression before '>' token
     void visiting(string<BaseNode*> z) {
                                   ^
SmartPointer.hpp:9:10: error: 'void FormatVisitor::Visit(const int*)' marked 'override', but does not override
     void Visit(const BaseNode* node) override {
          ^~~~~
SmartPointer.hpp: In member function 'void FormatVisitor::Visit(const int*)':
SmartPointer.hpp:10:15: error: request for member 'Visit' in '* node', which is of non-class type 'const int'
         node->Visit(this);
               ^~~~~
SmartPointer.hpp: In member function 'void FormatVisitor::Visit(const int*)':
SmartPointer.hpp:14:34: error: request for member 'PublicFields' in '* node', which is of non-class type 'const int'
         int64_t pub_size = node->PublicFields().size();
                                  ^~~~~~~~~~~~
SmartPointer.hpp:15:35: error: request for member 'ProtectedFields' in '* node', which is of non-class type 'const int'
         int64_t prot_size = node->ProtectedFields().size();
                                   ^~~~~~~~~~~~~~~
SmartPointer.hpp:16:35: error: request for member 'PrivateFields' in '* node', which is of non-class type 'const int'
         int64_t priv_size = node->PrivateFields().size();
                                   ^~~~~~~~~~~~~
SmartPointer.hpp:18:47: error: request for member 'ClassName' in '* node', which is of non-class type 'const int'
         v.push_back(tubs() + "class " + node->ClassName() + " {");
                                               ^~~~~~~~~
SmartPointer.hpp:21:45: error: no matching function for call to 'std::__cxx11::basic_string<char>::push_back(std::__cxx11::basic_string<char>)'
             v.push_back(tubs() + "  public:");
                                             ^
In file included from /usr/include/c++/7/string:52:0,
                 from SmartPointer.hpp:2,
                 from main.cpp:2:
/usr/include/c++/7/bits/basic_string.h:1339:7: note: candidate: void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::push_back(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]
       push_back(_CharT __c)
       ^~~~~~~~~
/usr/include/c++/7/bits/basic_string.h:1339:7: note:   no known conversion for argument 1 from 'std::__cxx11::basic_string<char>' to 'char'
In file included from main.cpp:2:0:
SmartPointer.hpp:22:28: error: request for member 'PublicFields' in '* node', which is of non-class type 'const int'
             visiting(node->PublicFields());
                            ^~~~~~~~~~~~
SmartPointer.hpp:24:31: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
                 v.push_back("");
                               ^
In file included from /usr/include/c++/7/string:52:0,
                 from SmartPointer.hpp:2,
                 from main.cpp:2:
/usr/include/c++/7/bits/basic_string.h:1339:7: note:   initializing argument 1 of 'void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::push_back(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
       push_back(_CharT __c)
       ^~~~~~~~~
In file included from main.cpp:2:0:
SmartPointer.hpp:28:48: error: no matching function for call to 'std::__cxx11::basic_string<char>::push_back(std::__cxx11::basic_string<char>)'
             v.push_back(tubs() + "  protected:");
                                                ^
In file included from /usr/include/c++/7/string:52:0,
                 from SmartPointer.hpp:2,
                 from main.cpp:2:
/usr/include/c++/7/bits/basic_string.h:1339:7: note: candidate: void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::push_back(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]
       push_back(_CharT __c)
       ^~~~~~~~~
/usr/include/c++/7/bits/basic_string.h:1339:7: note:   no known conversion for argument 1 from 'std::__cxx11::basic_string<char>' to 'char'
In file included from main.cpp:2:0:
SmartPointer.hpp:29:28: error: request for member 'ProtectedFields' in '* node', which is of non-class type 'const int'
             visiting(node->ProtectedFields());
                            ^~~~~~~~~~~~~~~
SmartPointer.hpp:31:31: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
                 v.push_back("");
                               ^
In file included from /usr/include/c++/7/string:52:0,
                 from SmartPointer.hpp:2,
                 from main.cpp:2:
/usr/include/c++/7/bits/basic_string.h:1339:7: note:   initializing argument 1 of 'void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::push_back(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
       push_back(_CharT __c)
       ^~~~~~~~~
In file included from main.cpp:2:0:
SmartPointer.hpp:35:46: error: no matching function for call to 'std::__cxx11::basic_string<char>::push_back(std::__cxx11::basic_string<char>)'
             v.push_back(tubs() + "  private:");
                                              ^
In file included from /usr/include/c++/7/string:52:0,
                 from SmartPointer.hpp:2,
                 from main.cpp:2:
/usr/include/c++/7/bits/basic_string.h:1339:7: note: candidate: void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::push_back(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]
       push_back(_CharT __c)
       ^~~~~~~~~
/usr/include/c++/7/bits/basic_string.h:1339:7: note:   no known conversion for argument 1 from 'std::__cxx11::basic_string<char>' to 'char'
In file included from main.cpp:2:0:
SmartPointer.hpp:36:28: error: request for member 'PrivateFields' in '* node', which is of non-class type 'const int'
             visiting(node->PrivateFields());
                            ^~~~~~~~~~~~~
SmartPointer.hpp:39:34: error: no matching function for call to 'std::__cxx11::basic_string<char>::push_back(std::__cxx11::basic_string<char>)'
         v.push_back(tubs() + "};");
                                  ^
In file included from /usr/include/c++/7/string:52:0,
                 from SmartPointer.hpp:2,
                 from main.cpp:2:
/usr/include/c++/7/bits/basic_string.h:1339:7: note: candidate: void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::push_back(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]
       push_back(_CharT __c)
       ^~~~~~~~~
/usr/include/c++/7/bits/basic_string.h:1339:7: note:   no known conversion for argument 1 from 'std::__cxx11::basic_string<char>' to 'char'
In file included from main.cpp:2:0:
SmartPointer.hpp: In member function 'void FormatVisitor::Visit(const int*)':
SmartPointer.hpp:43:28: error: request for member 'TypeName' in '* node', which is of non-class type 'const int'
         string arg = node->TypeName() + " " + node->VarName();
                            ^~~~~~~~
SmartPointer.hpp:43:53: error: request for member 'VarName' in '* node', which is of non-class type 'const int'
         string arg = node->TypeName() + " " + node->VarName();
                                                     ^~~~~~~
SmartPointer.hpp:45:22: error: no match for 'operator+=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<char> >::value_type {aka char}' and 'std::__cxx11::string {aka std::__cxx11::basic_string<char>}')
             v.back() += arg;
             ~~~~~~~~~^~~~~~
SmartPointer.hpp:47:26: error: invalid conversion from 'char*' to '__gnu_cxx::__alloc_traits<std::allocator<char> >::value_type {aka char}' [-fpermissive]
                 v.back() += ", ";
                 ~~~~~~~~~^~~~~~~
SmartPointer.hpp:49:43: error: no matching function for call to 'std::__cxx11::basic_string<char>::push_back(std::__cxx11::basic_string<char>)'
             v.push_back(tubs() + arg + ";");
                                           ^
In file included from /usr/include/c++/7/string:52:0,
                 from SmartPointer.hpp:2,
                 from main.cpp:2:
/usr/include/c++/7/bits/basic_string.h:1339:7: note: candidate: void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::push_back(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]
       push_back(_CharT __c)
       ^~~~~~~~~
/usr/include/c++/7/bits/basic_string.h:1339:7: note:   no known conversion for argument 1 from 'std::__cxx11::basic_string<char>' to 'char'
In file included from main.cpp:2:0:
SmartPointer.hpp: In member function 'void FormatVisitor::Visit(const int*)':
SmartPointer.hpp:54:36: error: request for member 'ReturnTypeName' in '* node', which is of non-class type 'const int'
         v.push_back(tubs() + node->ReturnTypeName() + " "
                                    ^~~~~~~~~~~~~~
SmartPointer.hpp:55:21: error: request for member 'MethodName' in '* node', which is of non-class type 'const int'
             + node->MethodName() + "(");
                     ^~~~~~~~~~
SmartPointer.hpp:57:24: error: request for member 'Arguments' in '* node', which is of non-class type 'const int'
         visiting(node->Arguments());
                        ^~~~~~~~~
SmartPointer.hpp:58:18: error: invalid conversion from 'char*' to '__gnu_cxx::__alloc_traits<std::allocator<char> >::value_type {aka char}' [-fpermissive]
         v.back() += ");";
         ~~~~~~~~~^~~~~~~
SmartPointer.hpp: In member function 'void FormatVisitor::visiting(std::__cxx11::string)':
SmartPointer.hpp:84:17: error: base operand of '->' is not a pointer
             z[i]->Visit(this);
                 ^~
In file included from Test_SmartPointer.hpp:3:0,
                 from main.cpp:3:
SmartPointer.hpp: At global scope:
SmartPointer.hpp:7:7: error: redefinition of 'class FormatVisitor'
 class FormatVisitor : public BaseVisitor {
       ^~~~~~~~~~~~~
In file included from main.cpp:2:0:
SmartPointer.hpp:7:7: note: previous definition of 'class FormatVisitor'
 class FormatVisitor : public BaseVisitor {
       ^~~~~~~~~~~~~
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;
                              ^
Test_SmartPointer.hpp:11:30: error: 'SmartPointer' does not name a type
 using SmartPointer__type_t = SmartPointer<float, std::allocator<float>>;
                              ^~~~~~~~~~~~
Test_SmartPointer.hpp:12:38: error: 'SmartPointer' does not name a type
 using SmartPointer__another_type_t = SmartPointer<uint64_t, std::allocator<uint64_t>>;
                                      ^~~~~~~~~~~~
Test_SmartPointer.hpp: In function 'std::enable_if_t<std::is_floating_point<_Tp>::value> __stress_tests__SmartPointer_operator_star(const string&)':
Test_SmartPointer.hpp:17:5: error: there are no arguments to 'TEST_BLOCK' that depend on a template parameter, so a declaration of 'TEST_BLOCK' must be available [-fpermissive]
     TEST_BLOCK("[stress] SmartPointer[non-nullptr]::operator*() const") {
     ^~~~~~~~~~
Test_SmartPointer.hpp:17:5: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
Test_SmartPointer.hpp:17:73: error: expected ';' before '{' token
     TEST_BLOCK("[stress] SmartPointer[non-nullptr]::operator*() const") {
                                                                         ^
Test_SmartPointer.hpp:33:5: error: there are no arguments to 'TEST_BLOCK' that depend on a template parameter, so a declaration of 'TEST_BLOCK' must be available [-fpermissive]
     TEST_BLOCK("[stress] SmartPointer[non-nullptr]::operator*()") {
     ^~~~~~~~~~
Test_SmartPointer.hpp:33:67: error: expected ';' before '{' token
     TEST_BLOCK("[stress] SmartPointer[non-nullptr]::operator*()") {
                                                                   ^
Test_SmartPointer.hpp: In function 'std::enable_if_t<std::is_integral<_Tp>::value> __stress_tests__SmartPointer_operator_star(const string&)':
Test_SmartPointer.hpp:55:5: error: there are no arguments to 'TEST_BLOCK' that depend on a template parameter, so a declaration of 'TEST_BLOCK' must be available [-fpermissive]
     TEST_BLOCK("[stress] SmartPointer[non-nullptr]::operator*() const") {
     ^~~~~~~~~~
Test_SmartPointer.hpp:55:73: error: expected ';' before '{' token
     TEST_BLOCK("[stress] SmartPointer[non-nullptr]::operator*() const") {
                                                                         ^
In file included from main.cpp:3:0:
Test_SmartPointer.hpp:71:5: error: there are no arguments to 'TEST_BLOCK' that depend on a template parameter, so a declaration of 'TEST_BLOCK' must be available [-fpermissive]
     TEST_BLOCK("[stress] SmartPointer[non-nullptr]::operator*()") {
     ^~~~~~~~~~
Test_SmartPointer.hpp:71:67: error: expected ';' before '{' token
     TEST_BLOCK("[stress] SmartPointer[non-nullptr]::operator*()") {
                                                                   ^
Test_SmartPointer.hpp: At global scope:
Test_SmartPointer.hpp:97:19: error: expected constructor, destructor, or type conversion before '(' token
 DEFINE_CLASS_TESTS(SmartPointer__type_t) {
                   ^
main.cpp: In function 'int main()':
main.cpp:6:24: error: 'SmartPointer__type_t' was not declared in this scope
     EXECUTE_CLASS_TEST(SmartPointer__type_t);
                        ^~~~~~~~~~~~~~~~~~~~
main.cpp:6:5: error: 'EXECUTE_CLASS_TEST' was not declared in this scope
     EXECUTE_CLASS_TEST(SmartPointer__type_t);
     ^~~~~~~~~~~~~~~~~~
main.cpp:7:7: error: 'cout' is not a member of 'std'
  std::cout << 1 << std::endl;
       ^~~~
main.cpp:7:7: note: suggested alternative: 'cbrt'
  std::cout << 1 << std::endl;
       ^~~~
       cbrt
main.cpp:7:25: error: 'endl' is not a member of 'std'
  std::cout << 1 << std::endl;
                         ^~~~
main.cpp:7:25: note: suggested alternative: 'end'
  std::cout << 1 << std::endl;
                         ^~~~
                         end
0.035s 0.008s 9