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
Warnings due to std::reverse_iterator
using the deprecated std::iterator
#75057
Comments
The warning you're seeing is related to the use of This warning is likely triggered by your use of the |
Yes, a very indirect use, by using |
@var-const has this been introduced by your ranges to patch? |
@JohelEGP Can you please share how and what you're building in a reproducer? Ideally a godbolt link would make it really easy for us to see what's wrong. |
I build Libc++ according to https://libcxx.llvm.org/Modules.html#using-in-external-projects. import std;
int main() {
std::vector<int> v;
v.reserve(0);
} |
This doesn't happen if we're not building with modules: https://godbolt.org/z/vxYPabq5h @mordante Do you think you could have a first look? |
It appears we do not currently have a way to identify "system modules", amd all modules are considered user code, I think. |
@llvm/issue-subscribers-clang-modules Author: Johel Ernesto Guerrero Peña (JohelEGP)
```output
In module 'cpp2.util' imported from /home/johel/build/Waarudo/ClangRelease/sources/jegp/algorithms/algorithms.cpp:12:
/home/johel/Documents/C++/Forks/llvm/libcxx-std-modules/include/c++/v1/__iterator/reverse_iterator.h:53:14: warning: 'iterator<std::__1::random_access_iterator_tag, jegp::command>' is deprecated [-Wdeprecated-declarations]
53 | : public iterator<typename iterator_traits<_Iter>::iterator_category,
| ^
/home/johel/Documents/C++/Forks/llvm/libcxx-std-modules/include/c++/v1/__memory/uninitialized_algorithms.h:542:40: note: in instantiation of template class 'std::__1::reverse_iterator<jegp::command *>' requested here
542 | std::__allocator_destroy(__alloc_, std::reverse_iterator<_Iter>(__last_), std::reverse_iterator<_Iter>(__first_));
| ^
/home/johel/Documents/C++/Forks/llvm/libcxx-std-modules/include/c++/v1/__utility/exception_guard.h:86:7: note: in instantiation of member function 'std::_AllocatorDestroyRangeReverse<std::__1::allocator<jegp::command>, jegp::command *>::operator()' requested here
86 | __rollback_();
| ^
/home/johel/Documents/C++/Forks/llvm/libcxx-std-modules/include/c++/v1/__utility/exception_guard.h:137:10: note: in instantiation of member function 'std::__exception_guard_exceptions<std::_AllocatorDestroyRangeReverse<std::__1::allocator<jegp::command>, jegp::command *>>::~__exception_guard_exceptions' requested here
137 | return __exception_guard<_Rollback>(std::move(__rollback));
| ^
/home/johel/Documents/C++/Forks/llvm/libcxx-std-modules/include/c++/v1/__memory/uninitialized_algorithms.h:560:12: note: in instantiation of function template specialization 'std::__make_exception_guard<std::_AllocatorDestroyRangeReverse<std::__1::allocator<jegp::command>, jegp::command *>>' requested here
560 | std::__make_exception_guard(_AllocatorDestroyRangeReverse<_Alloc, _Iter2>(__alloc, __destruct_first, __first2));
| ^
/home/johel/Documents/C++/Forks/llvm/libcxx-std-modules/include/c++/v1/__memory/uninitialized_algorithms.h:603:26: note: in instantiation of function template specialization 'std::__uninitialized_allocator_copy_impl<std::__1::allocator<jegp::command>, std::__1::ranges::transform_view<std::__1::ranges::owning_view<std::__1::vector<std::__1::basic_string<char>>>, jegp::command (*)(std::__1::basic_string<char>)>::__iterator<false>, std::__1::ranges::transform_view<std::__1::ranges::owning_view<std::__1::vector<std::__1::basic_string<char>>>, jegp::command (*)(std::__1::basic_string<char>)>::__iterator<false>, jegp::command *>' requested here
603 | auto __result = std::__uninitialized_allocator_copy_impl(__alloc, __unwrapped_range.first, __unwrapped_range.second, std::__unwrap_iter(__first2));
| ^
/home/johel/Documents/C++/Forks/llvm/libcxx-std-modules/include/c++/v1/vector:1145:22: note: (skipping 5 contexts in backtrace; use -ftemplate-backtrace-limit=0 to see all)
1145 | __tx.__pos_ = std::__uninitialized_allocator_copy(__alloc(), __first, __last, __tx.__pos_);
| ^
/home/johel/build/Waarudo/ClangRelease/sources/jegp/algorithms/algorithms.cpp:100:57: note: in instantiation of function template specialization 'std::__1::ranges::to<std::__1::vector, std::__1::ranges::transform_view<std::__1::ranges::owning_view<std::__1::vector<std::__1::basic_string<char>>>, jegp::command (*)(std::__1::basic_string<char>)>>' requested here
100 | return CPP2_UFCS_QUALIFIED_TEMPLATE((std::ranges::),to<std::vector>)(CPP2_UFCS(std::views::transform)(std::move(v), command::make)); }
| ^
/home/johel/build/Waarudo/ClangRelease/sources/jegp/algorithms/algorithms.cpp:100:42: note: in instantiation of requirement here
100 | return CPP2_UFCS_QUALIFIED_TEMPLATE((std::ranges::),to<std::vector>)(CPP2_UFCS(std::views::transform)(std::move(v), command::make)); }
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/johel/Documents/C++/Forks/hsutter/waarudo/include/cpp2util_pre.h:373:72: note: expanded from macro 'CPP2_UFCS_QUALIFIED_TEMPLATE'
373 | #define CPP2_UFCS_QUALIFIED_TEMPLATE(QUALID,...) CPP2_UFCS_(&,QUALID,template,__VA_ARGS__)
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/johel/Documents/C++/Forks/hsutter/waarudo/include/cpp2util_pre.h:363:39: note: expanded from macro 'CPP2_UFCS_'
363 | requires CPP2_UFCS_CONSTRAINT_ARG(QUALID,TEMPKW,__VA_ARGS__) { \
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/johel/Documents/C++/Forks/hsutter/waarudo/include/cpp2util_pre.h:345:35: note: expanded from macro 'CPP2_UFCS_CONSTRAINT_ARG'
345 | || requires { CPP2_UFCS_REMPARENS QUALID __VA_ARGS__(CPP2_FORWARD(obj), CPP2_FORWARD(params)...); }
| ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/johel/Documents/C++/Forks/hsutter/waarudo/include/cpp2util_pre.h:306:34: note: expanded from macro 'CPP2_UFCS_REMPARENS'
306 | #define CPP2_UFCS_REMPARENS(...) __VA_ARGS__
| ^
/home/johel/build/Waarudo/ClangRelease/sources/jegp/algorithms/algorithms.cpp:100:12: note: while substituting template arguments into constraint expression here
100 | return CPP2_UFCS_QUALIFIED_TEMPLATE((std::ranges::),to<std::vector>)(CPP2_UFCS(std::views::transform)(std::move(v), command::make)); }
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/johel/Documents/C++/Forks/hsutter/waarudo/include/cpp2util_pre.h:373:59: note: expanded from macro 'CPP2_UFCS_QUALIFIED_TEMPLATE'
373 | #define CPP2_UFCS_QUALIFIED_TEMPLATE(QUALID,...) CPP2_UFCS_(&,QUALID,template,__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/johel/Documents/C++/Forks/hsutter/waarudo/include/cpp2util_pre.h:363:14: note: expanded from macro 'CPP2_UFCS_'
363 | requires CPP2_UFCS_CONSTRAINT_ARG(QUALID,TEMPKW,__VA_ARGS__) { \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/johel/Documents/C++/Forks/hsutter/waarudo/include/cpp2util_pre.h:345:4: note: expanded from macro 'CPP2_UFCS_CONSTRAINT_ARG'
345 | || requires { CPP2_UFCS_REMPARENS QUALID __VA_ARGS__(CPP2_FORWARD(obj), CPP2_FORWARD(params)...); }
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/johel/build/Waarudo/ClangRelease/sources/jegp/algorithms/algorithms.cpp:100:73: note: while checking constraint satisfaction for template 'operator()<std::__1::ranges::transform_view<std::__1::ranges::owning_view<std::__1::vector<std::__1::basic_string<char>>>, jegp::command (*)(std::__1::basic_string<char>)>>' required here
100 | return CPP2_UFCS_QUALIFIED_TEMPLATE((std::ranges::),to<std::vector>)(CPP2_UFCS(std::views::transform)(std::move(v), command::make)); }
| ^
/home/johel/build/Waarudo/ClangRelease/sources/jegp/algorithms/algorithms.cpp:100:73: note: in instantiation of function template specialization 'jegp::command::range_from_array_arguments(std::vector<std::string>)::(anonymous class)::operator()<std::__1::ranges::transform_view<std::__1::ranges::owning_view<std::__1::vector<std::__1::basic_string<char>>>, jegp::command (*)(std::__1::basic_string<char>)>>' requested here
/home/johel/Documents/C++/Forks/llvm/libcxx-std-modules/include/c++/v1/__iterator/iterator.h:24:29: note: 'iterator<std::__1::random_access_iterator_tag, jegp::command>' has been explicitly marked deprecated here
24 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 iterator
| ^
/home/johel/Documents/C++/Forks/llvm/libcxx-std-modules/include/c++/v1/__config:941:41: note: expanded from macro '_LIBCPP_DEPRECATED_IN_CXX17'
941 | # define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED
| ^
/home/johel/Documents/C++/Forks/llvm/libcxx-std-modules/include/c++/v1/__config:914:49: note: expanded from macro '_LIBCPP_DEPRECATED'
914 | # define _LIBCPP_DEPRECATED __attribute__((__deprecated__))
| ^
```
|
@llvm/issue-subscribers-clang-frontend Author: Johel Ernesto Guerrero Peña (JohelEGP)
```output
In module 'cpp2.util' imported from /home/johel/build/Waarudo/ClangRelease/sources/jegp/algorithms/algorithms.cpp:12:
/home/johel/Documents/C++/Forks/llvm/libcxx-std-modules/include/c++/v1/__iterator/reverse_iterator.h:53:14: warning: 'iterator<std::__1::random_access_iterator_tag, jegp::command>' is deprecated [-Wdeprecated-declarations]
53 | : public iterator<typename iterator_traits<_Iter>::iterator_category,
| ^
/home/johel/Documents/C++/Forks/llvm/libcxx-std-modules/include/c++/v1/__memory/uninitialized_algorithms.h:542:40: note: in instantiation of template class 'std::__1::reverse_iterator<jegp::command *>' requested here
542 | std::__allocator_destroy(__alloc_, std::reverse_iterator<_Iter>(__last_), std::reverse_iterator<_Iter>(__first_));
| ^
/home/johel/Documents/C++/Forks/llvm/libcxx-std-modules/include/c++/v1/__utility/exception_guard.h:86:7: note: in instantiation of member function 'std::_AllocatorDestroyRangeReverse<std::__1::allocator<jegp::command>, jegp::command *>::operator()' requested here
86 | __rollback_();
| ^
/home/johel/Documents/C++/Forks/llvm/libcxx-std-modules/include/c++/v1/__utility/exception_guard.h:137:10: note: in instantiation of member function 'std::__exception_guard_exceptions<std::_AllocatorDestroyRangeReverse<std::__1::allocator<jegp::command>, jegp::command *>>::~__exception_guard_exceptions' requested here
137 | return __exception_guard<_Rollback>(std::move(__rollback));
| ^
/home/johel/Documents/C++/Forks/llvm/libcxx-std-modules/include/c++/v1/__memory/uninitialized_algorithms.h:560:12: note: in instantiation of function template specialization 'std::__make_exception_guard<std::_AllocatorDestroyRangeReverse<std::__1::allocator<jegp::command>, jegp::command *>>' requested here
560 | std::__make_exception_guard(_AllocatorDestroyRangeReverse<_Alloc, _Iter2>(__alloc, __destruct_first, __first2));
| ^
/home/johel/Documents/C++/Forks/llvm/libcxx-std-modules/include/c++/v1/__memory/uninitialized_algorithms.h:603:26: note: in instantiation of function template specialization 'std::__uninitialized_allocator_copy_impl<std::__1::allocator<jegp::command>, std::__1::ranges::transform_view<std::__1::ranges::owning_view<std::__1::vector<std::__1::basic_string<char>>>, jegp::command (*)(std::__1::basic_string<char>)>::__iterator<false>, std::__1::ranges::transform_view<std::__1::ranges::owning_view<std::__1::vector<std::__1::basic_string<char>>>, jegp::command (*)(std::__1::basic_string<char>)>::__iterator<false>, jegp::command *>' requested here
603 | auto __result = std::__uninitialized_allocator_copy_impl(__alloc, __unwrapped_range.first, __unwrapped_range.second, std::__unwrap_iter(__first2));
| ^
/home/johel/Documents/C++/Forks/llvm/libcxx-std-modules/include/c++/v1/vector:1145:22: note: (skipping 5 contexts in backtrace; use -ftemplate-backtrace-limit=0 to see all)
1145 | __tx.__pos_ = std::__uninitialized_allocator_copy(__alloc(), __first, __last, __tx.__pos_);
| ^
/home/johel/build/Waarudo/ClangRelease/sources/jegp/algorithms/algorithms.cpp:100:57: note: in instantiation of function template specialization 'std::__1::ranges::to<std::__1::vector, std::__1::ranges::transform_view<std::__1::ranges::owning_view<std::__1::vector<std::__1::basic_string<char>>>, jegp::command (*)(std::__1::basic_string<char>)>>' requested here
100 | return CPP2_UFCS_QUALIFIED_TEMPLATE((std::ranges::),to<std::vector>)(CPP2_UFCS(std::views::transform)(std::move(v), command::make)); }
| ^
/home/johel/build/Waarudo/ClangRelease/sources/jegp/algorithms/algorithms.cpp:100:42: note: in instantiation of requirement here
100 | return CPP2_UFCS_QUALIFIED_TEMPLATE((std::ranges::),to<std::vector>)(CPP2_UFCS(std::views::transform)(std::move(v), command::make)); }
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/johel/Documents/C++/Forks/hsutter/waarudo/include/cpp2util_pre.h:373:72: note: expanded from macro 'CPP2_UFCS_QUALIFIED_TEMPLATE'
373 | #define CPP2_UFCS_QUALIFIED_TEMPLATE(QUALID,...) CPP2_UFCS_(&,QUALID,template,__VA_ARGS__)
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/johel/Documents/C++/Forks/hsutter/waarudo/include/cpp2util_pre.h:363:39: note: expanded from macro 'CPP2_UFCS_'
363 | requires CPP2_UFCS_CONSTRAINT_ARG(QUALID,TEMPKW,__VA_ARGS__) { \
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/johel/Documents/C++/Forks/hsutter/waarudo/include/cpp2util_pre.h:345:35: note: expanded from macro 'CPP2_UFCS_CONSTRAINT_ARG'
345 | || requires { CPP2_UFCS_REMPARENS QUALID __VA_ARGS__(CPP2_FORWARD(obj), CPP2_FORWARD(params)...); }
| ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/johel/Documents/C++/Forks/hsutter/waarudo/include/cpp2util_pre.h:306:34: note: expanded from macro 'CPP2_UFCS_REMPARENS'
306 | #define CPP2_UFCS_REMPARENS(...) __VA_ARGS__
| ^
/home/johel/build/Waarudo/ClangRelease/sources/jegp/algorithms/algorithms.cpp:100:12: note: while substituting template arguments into constraint expression here
100 | return CPP2_UFCS_QUALIFIED_TEMPLATE((std::ranges::),to<std::vector>)(CPP2_UFCS(std::views::transform)(std::move(v), command::make)); }
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/johel/Documents/C++/Forks/hsutter/waarudo/include/cpp2util_pre.h:373:59: note: expanded from macro 'CPP2_UFCS_QUALIFIED_TEMPLATE'
373 | #define CPP2_UFCS_QUALIFIED_TEMPLATE(QUALID,...) CPP2_UFCS_(&,QUALID,template,__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/johel/Documents/C++/Forks/hsutter/waarudo/include/cpp2util_pre.h:363:14: note: expanded from macro 'CPP2_UFCS_'
363 | requires CPP2_UFCS_CONSTRAINT_ARG(QUALID,TEMPKW,__VA_ARGS__) { \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/johel/Documents/C++/Forks/hsutter/waarudo/include/cpp2util_pre.h:345:4: note: expanded from macro 'CPP2_UFCS_CONSTRAINT_ARG'
345 | || requires { CPP2_UFCS_REMPARENS QUALID __VA_ARGS__(CPP2_FORWARD(obj), CPP2_FORWARD(params)...); }
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/johel/build/Waarudo/ClangRelease/sources/jegp/algorithms/algorithms.cpp:100:73: note: while checking constraint satisfaction for template 'operator()<std::__1::ranges::transform_view<std::__1::ranges::owning_view<std::__1::vector<std::__1::basic_string<char>>>, jegp::command (*)(std::__1::basic_string<char>)>>' required here
100 | return CPP2_UFCS_QUALIFIED_TEMPLATE((std::ranges::),to<std::vector>)(CPP2_UFCS(std::views::transform)(std::move(v), command::make)); }
| ^
/home/johel/build/Waarudo/ClangRelease/sources/jegp/algorithms/algorithms.cpp:100:73: note: in instantiation of function template specialization 'jegp::command::range_from_array_arguments(std::vector<std::string>)::(anonymous class)::operator()<std::__1::ranges::transform_view<std::__1::ranges::owning_view<std::__1::vector<std::__1::basic_string<char>>>, jegp::command (*)(std::__1::basic_string<char>)>>' requested here
/home/johel/Documents/C++/Forks/llvm/libcxx-std-modules/include/c++/v1/__iterator/iterator.h:24:29: note: 'iterator<std::__1::random_access_iterator_tag, jegp::command>' has been explicitly marked deprecated here
24 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 iterator
| ^
/home/johel/Documents/C++/Forks/llvm/libcxx-std-modules/include/c++/v1/__config:941:41: note: expanded from macro '_LIBCPP_DEPRECATED_IN_CXX17'
941 | # define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED
| ^
/home/johel/Documents/C++/Forks/llvm/libcxx-std-modules/include/c++/v1/__config:914:49: note: expanded from macro '_LIBCPP_DEPRECATED'
914 | # define _LIBCPP_DEPRECATED __attribute__((__deprecated__))
| ^
```
|
@llvm/issue-subscribers-c-20 Author: Johel Ernesto Guerrero Peña (JohelEGP)
```output
In module 'cpp2.util' imported from /home/johel/build/Waarudo/ClangRelease/sources/jegp/algorithms/algorithms.cpp:12:
/home/johel/Documents/C++/Forks/llvm/libcxx-std-modules/include/c++/v1/__iterator/reverse_iterator.h:53:14: warning: 'iterator<std::__1::random_access_iterator_tag, jegp::command>' is deprecated [-Wdeprecated-declarations]
53 | : public iterator<typename iterator_traits<_Iter>::iterator_category,
| ^
/home/johel/Documents/C++/Forks/llvm/libcxx-std-modules/include/c++/v1/__memory/uninitialized_algorithms.h:542:40: note: in instantiation of template class 'std::__1::reverse_iterator<jegp::command *>' requested here
542 | std::__allocator_destroy(__alloc_, std::reverse_iterator<_Iter>(__last_), std::reverse_iterator<_Iter>(__first_));
| ^
/home/johel/Documents/C++/Forks/llvm/libcxx-std-modules/include/c++/v1/__utility/exception_guard.h:86:7: note: in instantiation of member function 'std::_AllocatorDestroyRangeReverse<std::__1::allocator<jegp::command>, jegp::command *>::operator()' requested here
86 | __rollback_();
| ^
/home/johel/Documents/C++/Forks/llvm/libcxx-std-modules/include/c++/v1/__utility/exception_guard.h:137:10: note: in instantiation of member function 'std::__exception_guard_exceptions<std::_AllocatorDestroyRangeReverse<std::__1::allocator<jegp::command>, jegp::command *>>::~__exception_guard_exceptions' requested here
137 | return __exception_guard<_Rollback>(std::move(__rollback));
| ^
/home/johel/Documents/C++/Forks/llvm/libcxx-std-modules/include/c++/v1/__memory/uninitialized_algorithms.h:560:12: note: in instantiation of function template specialization 'std::__make_exception_guard<std::_AllocatorDestroyRangeReverse<std::__1::allocator<jegp::command>, jegp::command *>>' requested here
560 | std::__make_exception_guard(_AllocatorDestroyRangeReverse<_Alloc, _Iter2>(__alloc, __destruct_first, __first2));
| ^
/home/johel/Documents/C++/Forks/llvm/libcxx-std-modules/include/c++/v1/__memory/uninitialized_algorithms.h:603:26: note: in instantiation of function template specialization 'std::__uninitialized_allocator_copy_impl<std::__1::allocator<jegp::command>, std::__1::ranges::transform_view<std::__1::ranges::owning_view<std::__1::vector<std::__1::basic_string<char>>>, jegp::command (*)(std::__1::basic_string<char>)>::__iterator<false>, std::__1::ranges::transform_view<std::__1::ranges::owning_view<std::__1::vector<std::__1::basic_string<char>>>, jegp::command (*)(std::__1::basic_string<char>)>::__iterator<false>, jegp::command *>' requested here
603 | auto __result = std::__uninitialized_allocator_copy_impl(__alloc, __unwrapped_range.first, __unwrapped_range.second, std::__unwrap_iter(__first2));
| ^
/home/johel/Documents/C++/Forks/llvm/libcxx-std-modules/include/c++/v1/vector:1145:22: note: (skipping 5 contexts in backtrace; use -ftemplate-backtrace-limit=0 to see all)
1145 | __tx.__pos_ = std::__uninitialized_allocator_copy(__alloc(), __first, __last, __tx.__pos_);
| ^
/home/johel/build/Waarudo/ClangRelease/sources/jegp/algorithms/algorithms.cpp:100:57: note: in instantiation of function template specialization 'std::__1::ranges::to<std::__1::vector, std::__1::ranges::transform_view<std::__1::ranges::owning_view<std::__1::vector<std::__1::basic_string<char>>>, jegp::command (*)(std::__1::basic_string<char>)>>' requested here
100 | return CPP2_UFCS_QUALIFIED_TEMPLATE((std::ranges::),to<std::vector>)(CPP2_UFCS(std::views::transform)(std::move(v), command::make)); }
| ^
/home/johel/build/Waarudo/ClangRelease/sources/jegp/algorithms/algorithms.cpp:100:42: note: in instantiation of requirement here
100 | return CPP2_UFCS_QUALIFIED_TEMPLATE((std::ranges::),to<std::vector>)(CPP2_UFCS(std::views::transform)(std::move(v), command::make)); }
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/johel/Documents/C++/Forks/hsutter/waarudo/include/cpp2util_pre.h:373:72: note: expanded from macro 'CPP2_UFCS_QUALIFIED_TEMPLATE'
373 | #define CPP2_UFCS_QUALIFIED_TEMPLATE(QUALID,...) CPP2_UFCS_(&,QUALID,template,__VA_ARGS__)
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/johel/Documents/C++/Forks/hsutter/waarudo/include/cpp2util_pre.h:363:39: note: expanded from macro 'CPP2_UFCS_'
363 | requires CPP2_UFCS_CONSTRAINT_ARG(QUALID,TEMPKW,__VA_ARGS__) { \
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/johel/Documents/C++/Forks/hsutter/waarudo/include/cpp2util_pre.h:345:35: note: expanded from macro 'CPP2_UFCS_CONSTRAINT_ARG'
345 | || requires { CPP2_UFCS_REMPARENS QUALID __VA_ARGS__(CPP2_FORWARD(obj), CPP2_FORWARD(params)...); }
| ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/johel/Documents/C++/Forks/hsutter/waarudo/include/cpp2util_pre.h:306:34: note: expanded from macro 'CPP2_UFCS_REMPARENS'
306 | #define CPP2_UFCS_REMPARENS(...) __VA_ARGS__
| ^
/home/johel/build/Waarudo/ClangRelease/sources/jegp/algorithms/algorithms.cpp:100:12: note: while substituting template arguments into constraint expression here
100 | return CPP2_UFCS_QUALIFIED_TEMPLATE((std::ranges::),to<std::vector>)(CPP2_UFCS(std::views::transform)(std::move(v), command::make)); }
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/johel/Documents/C++/Forks/hsutter/waarudo/include/cpp2util_pre.h:373:59: note: expanded from macro 'CPP2_UFCS_QUALIFIED_TEMPLATE'
373 | #define CPP2_UFCS_QUALIFIED_TEMPLATE(QUALID,...) CPP2_UFCS_(&,QUALID,template,__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/johel/Documents/C++/Forks/hsutter/waarudo/include/cpp2util_pre.h:363:14: note: expanded from macro 'CPP2_UFCS_'
363 | requires CPP2_UFCS_CONSTRAINT_ARG(QUALID,TEMPKW,__VA_ARGS__) { \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/johel/Documents/C++/Forks/hsutter/waarudo/include/cpp2util_pre.h:345:4: note: expanded from macro 'CPP2_UFCS_CONSTRAINT_ARG'
345 | || requires { CPP2_UFCS_REMPARENS QUALID __VA_ARGS__(CPP2_FORWARD(obj), CPP2_FORWARD(params)...); }
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/johel/build/Waarudo/ClangRelease/sources/jegp/algorithms/algorithms.cpp:100:73: note: while checking constraint satisfaction for template 'operator()<std::__1::ranges::transform_view<std::__1::ranges::owning_view<std::__1::vector<std::__1::basic_string<char>>>, jegp::command (*)(std::__1::basic_string<char>)>>' required here
100 | return CPP2_UFCS_QUALIFIED_TEMPLATE((std::ranges::),to<std::vector>)(CPP2_UFCS(std::views::transform)(std::move(v), command::make)); }
| ^
/home/johel/build/Waarudo/ClangRelease/sources/jegp/algorithms/algorithms.cpp:100:73: note: in instantiation of function template specialization 'jegp::command::range_from_array_arguments(std::vector<std::string>)::(anonymous class)::operator()<std::__1::ranges::transform_view<std::__1::ranges::owning_view<std::__1::vector<std::__1::basic_string<char>>>, jegp::command (*)(std::__1::basic_string<char>)>>' requested here
/home/johel/Documents/C++/Forks/llvm/libcxx-std-modules/include/c++/v1/__iterator/iterator.h:24:29: note: 'iterator<std::__1::random_access_iterator_tag, jegp::command>' has been explicitly marked deprecated here
24 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 iterator
| ^
/home/johel/Documents/C++/Forks/llvm/libcxx-std-modules/include/c++/v1/__config:941:41: note: expanded from macro '_LIBCPP_DEPRECATED_IN_CXX17'
941 | # define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED
| ^
/home/johel/Documents/C++/Forks/llvm/libcxx-std-modules/include/c++/v1/__config:914:49: note: expanded from macro '_LIBCPP_DEPRECATED'
914 | # define _LIBCPP_DEPRECATED __attribute__((__deprecated__))
| ^
```
|
Oh, I missed this some how. Yes, we don't treat std modules specially now. We can make it by adding another bit in clang::Module. I'll try to handle that. |
Note that we removed `-Werror` to `-Wno-deprecated-declarations` due to a bug in clang:llvm/llvm-project#75057
I got confused after I look into aafad2d. For the reproducer:
I dumped the
then it looks... somewhat correct... the instantiation loc is indeed not in system headers or modules. And in fact, I feel like the original patch "looks" correct for modules since currently the std modules are basically wrappers for headers. Also the original reproducer from the thread and the duplicated reproducer in #79734 shows that the instantiation location lives in the users code... so I feel more confused... |
@ChuanqiXu9 in This uses Does that make sense? |
But my problem is, the dumpped
|
Repro https://godbolt.org/z/4rz4rehcz |
@ChuanqiXu9 a good start might be to create a module version of this test https://github.com/llvm/llvm-project/blob/main/clang/test/SemaCXX/warn-deprecated-specializations-in-system-headers.cpp |
Yeah, I made it. And it looks like it works perfectly...
(Note that header.h is in a differrent TU of test.cc. So we can't put Given this looks good. I'd like to commit the test directly to increase the test coverage. And I am not sure if you misunderstand my point. My point is that the behavior of |
@ChuanqiXu9 Yes, I'm a bit confused, sorry. Can we agree that I haven't found any logic in clang to handle system (standard) module. |
Yes, it should be wrong. But my confusion point is, I didn't see the For example, if I insert the following code into aafad2d#diff-e32ebf7695e8361164e8f353f15548838d994990b08f29778bc6aced8f2ecb01R547
and compile the reproducer (https://godbolt.org/z/4rz4rehcz) locally, I'll see:
And from the log I see the only location that makes So I am wondering if the change of patch itself is good but something bad happens in other places of the code path. But that patch triggers it.
Yes, there isn't such one. Since our previous consensus it try to avoid treating std modules special as much as possible. For playing locally, you can use And I don't know there is a map from llvm-project/libcxx/modules/std.cppm.in Lines 14 to 57 in 0ef61ed
#pragma clang system_modules in the future, but I think it should be fine now.
|
@cor3ntin gentle ping |
BTW, @mordante do you think if this is a good example that we need more tests about (I know there are some practical issues in testing std module more in libc++. I just want to know if it is still on the plan) |
I still like to have more libc++ tests using |
I've hit this too. Using It's made more painful because Emacs is highlighting some of the "In module 'std' imported" lines as errors, so I'd need to work on Emacs config if I want to be able to scroll through my build output for errors without being swamped with is stuff. |
@cor3ntin may you take a look at this? |
@ChuanqiXu9 I am afraid i don't really have time to look at that at the moment (and it's unclear to me how to implement "isIsStdModule" for a given source location) |
@cor3ntin oh, I am not asking you to implement If you don't have time, how do you think about reverting aafad2d temporarily? |
I don't think this is a good option, we rely on this mechanism to display deprecation warnings in libc++. |
@cor3ntin I found a reproducer, but I am not sure if the base line is correct.
Here I thought I got a reproducer. But I suddenly find the baseline of the reproducer (which only uses headers) will fail too. Is this behavior expected or not? @mordante Then I am wondering the original reproducer, where the message shows the deprecated |
The only main difference I see is your header has no include guards and we use |
The behavior of the warning in the header case is consistent with the intent of aafad2d
|
Yeah, maybe we need to look at the instantiation trace at: https://godbolt.org/z/K94xYPhPG since it looks like the root of the instantiation started from user's code too. We need to make sure if the instantiation path different in modules and in headers mode. @mordante |
Some update for this, I inserted
to https://github.com/llvm/llvm-project/blob/main/clang/lib/Sema/SemaAvailability.cpp#L547 and I tried to compile the following code with libc++
And I see
I suspect it just works due to some surprising matches in diagnostic engines and it just didn't match with modules. I need to debug more. @cor3ntin would you like to check it? I feel the original implementation has some problems which got covered by other places. |
with headers version, the value of @mordante can you take a look at the instantiation path to make sure if it is fine or problematic actually? Here is the path in my environment:
|
Oh, I finally got a reproducer:
then the behavior of libc++ should be fine. It is the fault of clang didn't handle these llvm-project/clang/lib/Sema/SemaAvailability.cpp Lines 543 to 554 in bf57d2e
|
Oh, this turns out to be some "optimization" I did before, which get revealed by the above change. I'll fix this quickly. Sorry for wasting your time : ( |
Close #75057 Previously, I thought the diagnostic mappings is not meaningful with modules incorrectly. And this problem get revealed by another change recently. So this patch tried to rever the previous "optimization" partially.
@ChuanqiXu9 Sorry I wasn't of more help (modules confuse me)! Thanks for working on it |
The text was updated successfully, but these errors were encountered: