Skip to content

Q: Would you please help to repair the clang bug? #132

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

Closed
ackelcn opened this issue Jun 6, 2022 · 7 comments
Closed

Q: Would you please help to repair the clang bug? #132

ackelcn opened this issue Jun 6, 2022 · 7 comments
Assignees
Labels
Question Further information is requested

Comments

@ackelcn
Copy link

ackelcn commented Jun 6, 2022

I read this commit, and it fixed a clang bug:

97a5947

However, this fix looks ad hoc. It can fail to workaround this issue, if future clangs make unexpected modifications. I have filed a bug report to clang:
llvm/llvm-project#55894

Would you provide more details? If clang fixed this issue, this problem can be fully fixed.

@ackelcn ackelcn added the Question Further information is requested label Jun 6, 2022
@the-moisrex
Copy link
Owner

the-moisrex commented Jun 6, 2022

It was more than a year ago, I don't remember the clang bug. But based on the version specified in this close proximity commit, I think it was clang version 11.0.1.

@the-moisrex
Copy link
Owner

Clang 14 with the bug added to the project:

[1/3] /data/data/com.termux/files/usr/bin/c++ -DBOOST_CONTAINER_DYN_LINK -DBOOST_CONTAINER_NO_LIB -DFMT_LOCALE -DONLY_C_LOCALE=0 -DUSE_OS_TZDB=1 -DWEBPP_PROJECT_ROOT=/data/data/com.termux/files/home/webpp -I/data/data/com.termux/files/home/webpp/core/include -I/data/data/com.termux/files/home/.cache/CPM/magic_enum/efad5da2078693b2297391a45cee3fe582b14d4e/include -I/data/data/com.termux/files/home/.cache/CPM/date/1230e11484394d992b71c8ba4a799f8f780fa55e/include -I/data/data/com.termux/files/home/.cache/CPM/fmt/94859507056a00b592e83ccd2aa822f8daf63291/include -I/data/data/com.termux/files/home/.cache/CPM/fixed_string/3c57855b5114f8af7456226a258ac304237aaa7e/include -I/data/data/com.termux/files/home/.cache/CPM/ctre/56dbc5ec65a8eb5368f1f433a84f8033d0a35c1d/include -isystem /data/data/com.termux/files/home/.cache/CPM/rapidjson/cd691dc921e188c783f6dc5a96e2c13a6959725b/include -isystem /data/data/com.termux/files/home/.cache/CPM/googletest/1bf90834ecf641484cf737925b8552199058256e/googletest/include -isystem /data/data/com.termux/files/home/.cache/CPM/googletest/1bf90834ecf641484cf737925b8552199058256e/googletest -g -Wall -Wpedantic -Wextra -Wconversion -Wshadow -fcolor-diagnostics -std=c++20 -Winvalid-pch -fpch-instantiate-templates -Xclang -emit-pch -Xclang -include -Xclang /data/data/com.termux/files/home/webpp/build/tests/CMakeFiles/test-cookies.dir/cmake_pch.hxx -x c++-header -MD -MT tests/CMakeFiles/test-cookies.dir/cmake_pch.hxx.pch -MF tests/CMakeFiles/test-cookies.dir/cmake_pch.hxx.pch.d -o tests/CMakeFiles/test-cookies.dir/cmake_pch.hxx.pch -c /data/data/com.termux/files/home/webpp/build/tests/CMakeFiles/test-cookies.dir/cmake_pch.hxx.cxx
[2/3] /data/data/com.termux/files/usr/bin/c++ -DBOOST_CONTAINER_DYN_LINK -DBOOST_CONTAINER_NO_LIB -DFMT_LOCALE -DONLY_C_LOCALE=0 -DUSE_OS_TZDB=1 -DWEBPP_PROJECT_ROOT=/data/data/com.termux/files/home/webpp -I/data/data/com.termux/files/home/webpp/core/include -I/data/data/com.termux/files/home/.cache/CPM/magic_enum/efad5da2078693b2297391a45cee3fe582b14d4e/include -I/data/data/com.termux/files/home/.cache/CPM/date/1230e11484394d992b71c8ba4a799f8f780fa55e/include -I/data/data/com.termux/files/home/.cache/CPM/fmt/94859507056a00b592e83ccd2aa822f8daf63291/include -I/data/data/com.termux/files/home/.cache/CPM/fixed_string/3c57855b5114f8af7456226a258ac304237aaa7e/include -I/data/data/com.termux/files/home/.cache/CPM/ctre/56dbc5ec65a8eb5368f1f433a84f8033d0a35c1d/include -isystem /data/data/com.termux/files/home/.cache/CPM/rapidjson/cd691dc921e188c783f6dc5a96e2c13a6959725b/include -isystem /data/data/com.termux/files/home/.cache/CPM/googletest/1bf90834ecf641484cf737925b8552199058256e/googletest/include -isystem /data/data/com.termux/files/home/.cache/CPM/googletest/1bf90834ecf641484cf737925b8552199058256e/googletest -g -Wall -Wpedantic -Wextra -Wconversion -Wshadow -fcolor-diagnostics -std=c++20 -Winvalid-pch -Xclang -include-pch -Xclang /data/data/com.termux/files/home/webpp/build/tests/CMakeFiles/test-cookies.dir/cmake_pch.hxx.pch -Xclang -include -Xclang /data/data/com.termux/files/home/webpp/build/tests/CMakeFiles/test-cookies.dir/cmake_pch.hxx -MD -MT tests/CMakeFiles/test-cookies.dir/cookies_test.cpp.o -MF tests/CMakeFiles/test-cookies.dir/cookies_test.cpp.o.d -o tests/CMakeFiles/test-cookies.dir/cookies_test.cpp.o -c /data/data/com.termux/files/home/webpp/tests/cookies_test.cpp
FAILED: tests/CMakeFiles/test-cookies.dir/cookies_test.cpp.o
/data/data/com.termux/files/usr/bin/c++ -DBOOST_CONTAINER_DYN_LINK -DBOOST_CONTAINER_NO_LIB -DFMT_LOCALE -DONLY_C_LOCALE=0 -DUSE_OS_TZDB=1 -DWEBPP_PROJECT_ROOT=/data/data/com.termux/files/home/webpp -I/data/data/com.termux/files/home/webpp/core/include -I/data/data/com.termux/files/home/.cache/CPM/magic_enum/efad5da2078693b2297391a45cee3fe582b14d4e/include -I/data/data/com.termux/files/home/.cache/CPM/date/1230e11484394d992b71c8ba4a799f8f780fa55e/include -I/data/data/com.termux/files/home/.cache/CPM/fmt/94859507056a00b592e83ccd2aa822f8daf63291/include -I/data/data/com.termux/files/home/.cache/CPM/fixed_string/3c57855b5114f8af7456226a258ac304237aaa7e/include -I/data/data/com.termux/files/home/.cache/CPM/ctre/56dbc5ec65a8eb5368f1f433a84f8033d0a35c1d/include -isystem /data/data/com.termux/files/home/.cache/CPM/rapidjson/cd691dc921e188c783f6dc5a96e2c13a6959725b/include -isystem /data/data/com.termux/files/home/.cache/CPM/googletest/1bf90834ecf641484cf737925b8552199058256e/googletest/include -isystem /data/data/com.termux/files/home/.cache/CPM/googletest/1bf90834ecf641484cf737925b8552199058256e/googletest -g -Wall -Wpedantic -Wextra -Wconversion -Wshadow -fcolor-diagnostics -std=c++20 -Winvalid-pch -Xclang -include-pch -Xclang /data/data/com.termux/files/home/webpp/build/tests/CMakeFiles/test-cookies.dir/cmake_pch.hxx.pch -Xclang -include -Xclang /data/data/com.termux/files/home/webpp/build/tests/CMakeFiles/test-cookies.dir/cmake_pch.hxx -MD -MT tests/CMakeFiles/test-cookies.dir/cookies_test.cpp.o -MF tests/CMakeFiles/test-cookies.dir/cookies_test.cpp.o.d -o tests/CMakeFiles/test-cookies.dir/cookies_test.cpp.o -c /data/data/com.termux/files/home/webpp/tests/cookies_test.cpp
In file included from /data/data/com.termux/files/home/webpp/tests/cookies_test.cpp:1:
In file included from /data/data/com.termux/files/home/webpp/tests/../core/include/webpp/http/cookies/request_cookie_jar.hpp:6:
In file included from /data/data/com.termux/files/home/webpp/tests/../core/include/webpp/http/cookies/../../strings/parser_utils.hpp:6:
In file included from /data/data/com.termux/files/home/webpp/tests/../core/include/webpp/http/cookies/../../strings/charset.hpp:5:
In file included from /data/data/com.termux/files/home/webpp/tests/../core/include/webpp/http/cookies/../../strings/../std/string.hpp:6:
In file included from /data/data/com.termux/files/home/webpp/tests/../core/include/webpp/http/cookies/../../strings/../std/../traits/traits.hpp:6:
/data/data/com.termux/files/home/webpp/tests/../core/include/webpp/http/cookies/../../strings/../std/../traits/../memory/allocator_concepts.hpp:256:89: error: template template argument has different template parameters than its corresponding template template parameter
      typename istl::filter_parameters<istl::templated_negation<stl::is_void>::template type,
                                                                                        ^
/data/data/com.termux/files/home/webpp/tests/../core/include/webpp/http/cookies/../../strings/../std/../traits/../logs/../std/type_traits.hpp:804:31: note: template type parameter pack does not match template type parameter in template argument
        template <typename... T>
                              ^
/data/data/com.termux/files/home/webpp/tests/../core/include/webpp/http/cookies/../../strings/../std/../traits/../logs/../std/type_traits.hpp:733:33: note: previous template type parameter declared here
    template <template <typename> typename Concept, typename Tup>
                                ^
In file included from /data/data/com.termux/files/home/webpp/tests/cookies_test.cpp:1:
In file included from /data/data/com.termux/files/home/webpp/tests/../core/include/webpp/http/cookies/request_cookie_jar.hpp:6:
In file included from /data/data/com.termux/files/home/webpp/tests/../core/include/webpp/http/cookies/../../strings/parser_utils.hpp:6:
In file included from /data/data/com.termux/files/home/webpp/tests/../core/include/webpp/http/cookies/../../strings/charset.hpp:5:
In file included from /data/data/com.termux/files/home/webpp/tests/../core/include/webpp/http/cookies/../../strings/../std/string.hpp:6:
In file included from /data/data/com.termux/files/home/webpp/tests/../core/include/webpp/http/cookies/../../strings/../std/../traits/traits.hpp:7:
/data/data/com.termux/files/home/webpp/tests/../core/include/webpp/http/cookies/../../strings/../std/../traits/../memory/allocator_pack.hpp:353:32: error: no template named 'resource_extractor'; did you mean 'details::resource_extractor_impl'?
        using resources_type = resource_extractor<allocator_descriptors>;
                               ^~~~~~~~~~~~~~~~~~
                               details::resource_extractor_impl
/data/data/com.termux/files/home/webpp/tests/../core/include/webpp/http/cookies/../../strings/../std/../traits/../memory/allocator_concepts.hpp:169:16: note: 'details::resource_extractor_impl' declared here
        struct resource_extractor_impl;
               ^

the-moisrex added a commit that referenced this issue Jun 6, 2022
@the-moisrex
Copy link
Owner

IMG_20220606_055712.jpg

Bug can be reproduced with this:

template <template <typename> typename T>
struct one {
  using type = T<int>;
};

template <typename...T>
struct two {

};

auto main() -> int {

  using type = one<two>;

  return 0;
}

I'm not sure if this is legal C++ or not!

@the-moisrex
Copy link
Owner

It seems like it's a GCC bug that it's a bit more permissive than mavc and clang.

https://godbolt.org/z/qPqbPjEa7

@the-moisrex
Copy link
Owner

Oh, it is standard.
It'll work if you pass -frelaxed-template-template-args compiler flag to clang.

@the-moisrex
Copy link
Owner

IMG_20220606_063839.jpg

Here's a link to the description: https://en.cppreference.com/w/cpp/language/template_parameters

Clang description on this: https://clang.llvm.org/cxx_status.html#p0522

@ackelcn
Copy link
Author

ackelcn commented Jun 9, 2022

Many thanks for the explanation. Clang developers are working on this problem: https://reviews.llvm.org/D109496

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question Further information is requested
Projects
Status: No status
Development

No branches or pull requests

2 participants