Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example.cpp fails to compile - GCC v.10.3.0 #3

Open
zingchen opened this issue Jul 17, 2021 · 2 comments
Open

example.cpp fails to compile - GCC v.10.3.0 #3

zingchen opened this issue Jul 17, 2021 · 2 comments

Comments

@zingchen
Copy link

zingchen commented Jul 17, 2021

The example.cpp fails to compile.

Here is my compiler's info.

    $ gcc --version
    gcc.exe (Rev5, Built by MSYS2 project) 10.3.0
    Copyright (C) 2020 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Below is the command line and output.

$ g++ -std=c++2a -pedantic -Wall -Wextra -Werror -O3 -Isingle-header/ -o example example.cpp && ./example
In file included from example.cpp:4:
single-header/sql.hpp: In static member function 'static constexpr auto sql::query<Str, Schemas>::parse_negation()':
single-header/sql.hpp:1514:51: error: 'cexpr::string<char, 4>' is not a valid type for a template non-type parameter because it is not structural
 1514 |     using node = sql::operation<"NOT", Row, ranode>;
      |                                                   ^
single-header/sql.hpp:149:15: note: 'cexpr::string<char, 4>::size_' is not public
  149 |   std::size_t size_;
      |               ^~~~~
single-header/sql.hpp:1514:23: error: '<expression error>' in namespace 'sql' does not name a type
 1514 |     using node = sql::operation<"NOT", Row, ranode>;
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
single-header/sql.hpp:1516:30: error: 'node' was not declared in this scope; did you mean 'ranode'?
 1516 |     return context<next.pos, node>{};
      |                              ^~~~
      |                              ranode
single-header/sql.hpp:1516:34: error: template argument 2 is invalid
 1516 |     return context<next.pos, node>{};
      |                                  ^
single-header/sql.hpp: In static member function 'static constexpr auto sql::query<Str, Schemas>::recurse_and()':
single-header/sql.hpp:1537:72: error: 'cexpr::string<char, 4>' is not a valid type for a template non-type parameter because it is not structural
 1537 |     using node = sql::operation<"AND", Row, typename Left::node, ranode>;
      |                                                                        ^
single-header/sql.hpp:149:15: note: 'cexpr::string<char, 4>::size_' is not public
  149 |   std::size_t size_;
      |               ^~~~~
single-header/sql.hpp:1537:23: error: '<expression error>' in namespace 'sql' does not name a type
 1537 |     using node = sql::operation<"AND", Row, typename Left::node, ranode>;
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
single-header/sql.hpp:1539:42: error: 'node' was not declared in this scope; did you mean 'ranode'?
 1539 |     return recurse_and<context<next.pos, node>, Row>();
      |                                          ^~~~
      |                                          ranode
single-header/sql.hpp:1539:46: error: template argument 2 is invalid
 1539 |     return recurse_and<context<next.pos, node>, Row>();
      |                                              ^
single-header/sql.hpp: In static member function 'static constexpr auto sql::query<Str, Schemas>::recurse_or()':
single-header/sql.hpp:1565:71: error: 'cexpr::string<char, 3>' is not a valid type for a template non-type parameter because it is not structural
 1565 |     using node = sql::operation<"OR", Row, typename Left::node, ranode>;
      |                                                                       ^
single-header/sql.hpp:149:15: note: 'cexpr::string<char, 3>::size_' is not public
  149 |   std::size_t size_;
      |               ^~~~~
single-header/sql.hpp:1565:23: error: '<expression error>' in namespace 'sql' does not name a type
 1565 |     using node = sql::operation<"OR", Row, typename Left::node, ranode>;
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
single-header/sql.hpp:1567:41: error: 'node' was not declared in this scope; did you mean 'ranode'?
 1567 |     return recurse_or<context<next.pos, node>, Row>();
      |                                         ^~~~
      |                                         ranode
single-header/sql.hpp:1567:45: error: template argument 2 is invalid
 1567 |     return recurse_or<context<next.pos, node>, Row>();
      |                                             ^
example.cpp: At global scope:
example.cpp:8:30: error: 'cexpr::string<char, 6>' is not a valid type for a template non-type parameter because it is not structural
    8 |   "books", sql::index<"title">,
      |                              ^
In file included from example.cpp:4:
single-header/sql.hpp:149:15: note: 'cexpr::string<char, 6>::size_' is not public
  149 |   std::size_t size_;
      |               ^~~~~
example.cpp:9:35: error: 'cexpr::string<char, 6>' is not a valid type for a template non-type parameter because it is not structural
    9 |   sql::column<"title", std::string>,
      |                                   ^
In file included from example.cpp:4:
single-header/sql.hpp:149:15: note: 'cexpr::string<char, 6>::size_' is not public
  149 |   std::size_t size_;
      |               ^~~~~
example.cpp:10:35: error: 'cexpr::string<char, 6>' is not a valid type for a template non-type parameter because it is not structural
   10 |   sql::column<"genre", std::string>,
      |                                   ^
In file included from example.cpp:4:
single-header/sql.hpp:149:15: note: 'cexpr::string<char, 6>::size_' is not public
  149 |   std::size_t size_;
      |               ^~~~~
example.cpp:11:31: error: 'cexpr::string<char, 5>' is not a valid type for a template non-type parameter because it is not structural
   11 |   sql::column<"year", unsigned>,
      |                               ^
In file included from example.cpp:4:
single-header/sql.hpp:149:15: note: 'cexpr::string<char, 5>::size_' is not public
  149 |   std::size_t size_;
      |               ^~~~~
example.cpp:12:32: error: 'cexpr::string<char, 6>' is not a valid type for a template non-type parameter because it is not structural
   12 |   sql::column<"pages", unsigned>
      |                                ^
In file included from example.cpp:4:
single-header/sql.hpp:149:15: note: 'cexpr::string<char, 6>::size_' is not public
  149 |   std::size_t size_;
      |               ^~~~~
example.cpp:13:2: error: 'cexpr::string<char, 6>' is not a valid type for a template non-type parameter because it is not structural
   13 |  >;
      |  ^
In file included from example.cpp:4:
single-header/sql.hpp:149:15: note: 'cexpr::string<char, 6>::size_' is not public
  149 |   std::size_t size_;
      |               ^~~~~
example.cpp:13:2: error: template argument 2 is invalid
   13 |  >;
      |  ^
example.cpp:13:2: error: template argument 3 is invalid
example.cpp:13:2: error: template argument 4 is invalid
example.cpp:13:2: error: template argument 5 is invalid
example.cpp:13:2: error: template argument 6 is invalid
example.cpp:7:7: error: '<expression error>' in namespace 'sql' does not name a type
    7 |  sql::schema<
      |       ^~~~~~~
    8 |   "books", sql::index<"title">,
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    9 |   sql::column<"title", std::string>,
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   10 |   sql::column<"genre", std::string>,
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   11 |   sql::column<"year", unsigned>,
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   12 |   sql::column<"pages", unsigned>
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   13 |  >;
      |  ~
example.cpp:18:35: error: 'cexpr::string<char, 6>' is not a valid type for a template non-type parameter because it is not structural
   18 |   sql::column<"title", std::string>,
      |                                   ^
In file included from example.cpp:4:
single-header/sql.hpp:149:15: note: 'cexpr::string<char, 6>::size_' is not public
  149 |   std::size_t size_;
      |               ^~~~~
example.cpp:19:34: error: 'cexpr::string<char, 5>' is not a valid type for a template non-type parameter because it is not structural
   19 |   sql::column<"name", std::string>
      |                                  ^
In file included from example.cpp:4:
single-header/sql.hpp:149:15: note: 'cexpr::string<char, 5>::size_' is not public
  149 |   std::size_t size_;
      |               ^~~~~
example.cpp:20:2: error: 'cexpr::string<char, 9>' is not a valid type for a template non-type parameter because it is not structural
   20 |  >;
      |  ^
In file included from example.cpp:4:
single-header/sql.hpp:149:15: note: 'cexpr::string<char, 9>::size_' is not public
  149 |   std::size_t size_;
      |               ^~~~~
example.cpp:20:2: error: template argument 3 is invalid
   20 |  >;
      |  ^
example.cpp:20:2: error: template argument 4 is invalid
example.cpp:16:7: error: '<expression error>' in namespace 'sql' does not name a type
   16 |  sql::schema<
      |       ^~~~~~~
   17 |   "authored", sql::index<>,
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~
   18 |   sql::column<"title", std::string>,
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   19 |   sql::column<"name", std::string>
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   20 |  >;
      |  ~
example.cpp:27:3: error: 'books' was not declared in this scope
   27 |   books, authored
      |   ^~~~~
example.cpp:27:10: error: 'authored' was not declared in this scope
   27 |   books, authored
      |          ^~~~~~~~
example.cpp:28:2: error: 'cexpr::string<char, 193>' is not a valid type for a template non-type parameter because it is not structural
   28 |  >;
      |  ^
In file included from example.cpp:4:
single-header/sql.hpp:149:15: note: 'cexpr::string<char, 193>::size_' is not public
  149 |   std::size_t size_;
      |               ^~~~~
example.cpp:28:2: error: template argument 2 is invalid
   28 |  >;
      |  ^
example.cpp:28:2: error: template argument 3 is invalid
example.cpp:23:7: error: '<expression error>' in namespace 'sql' does not name a type
   23 |  sql::query<
      |       ^~~~~~
   24 |   "SELECT title AS book, name AS author, year, pages "
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   25 |   "FROM books NATURAL JOIN (SELECT * FROM authored WHERE name = \"Harlan Ellison\") "
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   26 |   "WHERE year = 1967 OR year >= 1972 AND genre = \"science fiction\"",
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   27 |   books, authored
      |   ~~~~~~~~~~~~~~~
   28 |  >;
      |  ~
example.cpp: In function 'int main()':
example.cpp:32:2: error: 'authored' was not declared in this scope
   32 |  authored a{ sql::load<authored>("tests/data/authored.tsv", '\t') };
      |  ^~~~~~~~
example.cpp:33:2: error: 'books' was not declared in this scope
   33 |  books b{ sql::load<books>("tests/data/books.tsv", '\t') };
      |  ^~~~~
example.cpp:35:7: error: 'query' was not declared in this scope; did you mean 'sql::query'?
   35 |  for (query q{ b, a }; auto const& [book, author, year, pages] : q)
      |       ^~~~~
      |       sql::query
In file included from example.cpp:4:
single-header/sql.hpp:1429:8: note: 'sql::query' declared here
 1429 |  class query
      |        ^~~~~
example.cpp:35:36: error: expected unqualified-id before '[' token
   35 |  for (query q{ b, a }; auto const& [book, author, year, pages] : q)
      |                                    ^
example.cpp:35:67: error: expected ';' before ')' token
   35 |  for (query q{ b, a }; auto const& [book, author, year, pages] : q)
      |                                                                   ^
      |                                                                   ;
example.cpp:37:16: error: 'book' was not declared in this scope; did you mean 'bool'?
   37 |   std::cout << book << '\t' << author << '\t' << year << '\t' << pages << '\n';
      |                ^~~~
      |                bool
example.cpp:37:32: error: 'author' was not declared in this scope; did you mean 'auto'?
   37 |   std::cout << book << '\t' << author << '\t' << year << '\t' << pages << '\n';
      |                                ^~~~~~
      |                                auto
example.cpp:37:50: error: 'year' was not declared in this scope
   37 |   std::cout << book << '\t' << author << '\t' << year << '\t' << pages << '\n';
      |                                                  ^~~~
example.cpp:37:66: error: 'pages' was not declared in this scope
   37 |   std::cout << book << '\t' << author << '\t' << year << '\t' << pages << '\n';
      |                                                                  ^~~~~
@zingchen
Copy link
Author

It seems that the most serious problem is

error: 'sql::{anonymous}::value<double>' is not a valid type for a template non-type parameter because it is not structural
        using node = sql::constant<sql::convert<val>(name), Row>
              ^
              note: 'sql::{anonymous}::value<double>::val' has a non-structural type

@zingchen
Copy link
Author

This is a workaround patch, just to make it compile. It's not about to solve the problem, which may be compiler bug.
workaround_patch.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant