c++: extend Wdangling-reference17.C [PR109642]
This patch extends g++.dg/warn/Wdangling-reference17.C with code from PR109642. I'm not creating a new test because this one already #includes the required headers. PR c++/109642 gcc/testsuite/ChangeLog: * g++.dg/warn/Wdangling-reference17.C: Additional testing.
This commit is contained in:
parent
bc77c035c4
commit
c596ce0312
1 changed files with 12 additions and 0 deletions
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include <vector>
|
||||
#include <ranges>
|
||||
#include <span>
|
||||
|
||||
int main()
|
||||
{
|
||||
|
@ -12,4 +13,15 @@ int main()
|
|||
{
|
||||
(void) i;
|
||||
}
|
||||
|
||||
// From c++/109642.
|
||||
const auto vec = std::vector{ 1, 2, 3 };
|
||||
const auto s = std::span<decltype(vec)::value_type const>{vec};
|
||||
|
||||
for ([[maybe_unused]] auto _ : s | std::views::take(2)) { }
|
||||
|
||||
for ([[maybe_unused]] auto _ : vec | std::views::take(2)) { }
|
||||
|
||||
const auto s_view = s | std::views::take(2);
|
||||
for ([[maybe_unused]] auto _ : s_view) { }
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue