Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Work around clang not inferring default args of template template args
Clang 16 fails to compile calls like "gather<Vector>()". c++ -O3 -pedantic -std=c++2a -g -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-address -frelaxed-template-template-args -Wno-ambiguous-reversed-operator -MD -MP -MF .command_manager.opt.d -c -o .command_manager.opt.o command_manager.cc command_manager.cc:825:104: error: no matching function for call to 'gather' auto params = tokens | skip(1) | transform(&Token::content) | filter(std::not_fn(is_switch)) | gather<Vector>(); ^~~~~~~~~~~~~~ ./ranges.hh:633:6: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'Container' auto gather() ^ ./ranges.hh:642:6: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'Container' auto gather() ^ 1 error generated. because Vector has a defaulted template argument but gather's formal parameter. Upstream bug report: llvm/llvm-project#42224 (not sure why it worked for us with Clang 15). Work around this by adding gather() overloads whose template template parameter clang can match against Vector. Add another one for HashSet. GCC rejects calls to these overloads as ambiguous, so use conditional compilation. Fixes mawww#4872
- Loading branch information