KhronosGroup / KhronosGroup/SYCL-CTS
vector deduction guides warning: variable length arrays in C++ are a Clang extension
- Dominant language
- C++
- Stars
- 75
- Forks
- 96
- Avg merge
- 5d 18h
- Merged PRs (30d)
- 4
Description
https://github.com/KhronosGroup/SYCL-CTS/blob/9691bc093d4d5b8965be68bfb0716e20fda6205b/tests/vector_deduction_guides/vec_deduction_guides.cpp#L30-L36
If I understand correctly, we need to replace `const` with `constexpr static` here:
https://github.com/KhronosGroup/SYCL-CTS/blob/9691bc093d4d5b8965be68bfb0716e20fda6205b/tests/vector_deduction_guides/vec_deduction_guides.cpp#L66-L67
The fact that class member variable is defined as `const` doesn't make it into a compile-time-known constant, it only means that it is immutable.
Build log:
```
[834/1195] Building CXX object tests/vector_deduction_guides/CMakeFiles/test_vector_deduction_guides_objects.dir/vec_deduction_guides.cpp.o
../tests/vector_deduction_guides/vec_deduction_guides.cpp:36:12: warning: variable length arrays in C++ are a Clang extension [-Wvla-cxx-extension]
36 | T data[max_size];
| ^~~~~~~~
../tests/vector_deduction_guides/../common/../common/type_coverage.h:404:5: note: in instantiation of member function 'vec_deduction_guides::check_vec_deduction::operator()' requested here
404 | ((action{}(std::forward(args)...,
| ^
../tests/vector_deduction_guides/vec_deduction_guides.cpp:90:3: note: in instantiation of function template specialization 'for_all_types' requested here
90 | for_all_types(deduction::vector_types);
| ^
../tests/vector_deduction_guides/../common/disabled_for_test_case.h:42:3: note: expanded from macro 'DISABLED_FOR_TEST_CASE'
42 | INTERNAL_CTS_DISABLED_FOR_TEST_CASE(__VA_ARGS__)
| ^
../tests/vector_deduction_guides/../common/disabled_for_test_case.h:130:40: note: expanded from macro 'INTERNAL_CTS_DISABLED_FOR_TEST_CASE'
130 | INTERNAL_CTS_MAYBE_DISABLE_TEST_CASE(INTERNAL_CTS_ENABLED_TEST_CASE, \
| ^
../tests/vector_deduction_guides/vec_deduction_guides.cpp:36:12: note: implicit use of 'this' pointer is only allowed within the evaluation of a call to a 'constexpr' member function
36 | T data[max_size];
| ^
```
Contributor guide
Research direction
Start in tests/vector_deduction_guides/vec_deduction_guides.cpp, reviewing lines 30-36 and 66-67 alongside the reported Clang build warning. Verify the constant declaration and rebuild the vector deduction guides test; done means the test compiles without the variable-length-array warning.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100