Ambiguous < operation for logical (compiler error)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Reproduce the supplied example with the compiler command and inspect cpp11/logicals.hpp, especially how cpp11::r_bool is compared during std::min. Resolve the ambiguity reported between the int and Rboolean operator< candidates; done when the example compiles without that error.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
With the following file
#include <cpp11.hpp>
#include <algorithm>
void c_test(cpp11::logicals t1, cpp11::logicals t2) {
std::min(t1[0],t2[0]);
}
I get
> cpp11::cpp_source("/home/vspinu/dev/iroll/src/tmp.cpp", quiet = F, clean = F, dir = '/home/vspinu/Dropbox/dev/iroll/')
g++ -std=gnu++11 -I"/home/vspinu/bin/R-4.1.2-bin/include" -DNDEBUG -I'/home/vspinu/.lib/4.1.2/cpp11/include' -I/usr/local/include -fpic -g -O2 -c /home/vspinu/Dropbox/dev/iroll/src/tmp.cpp -o /home/vspinu/Dropbox/dev/iroll/src/tmp.o
In file included from /usr/include/c++/7/algorithm:61:0,
from /home/vspinu/.lib/4.1.2/cpp11/include/cpp11/logicals.hpp:3,
from /home/vspinu/Dropbox/dev/iroll/src/tmp.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h: In instantiation of ‘const _Tp& std::min(const _Tp&, const _Tp&) [with _Tp = cpp11::r_bool]’:
/home/vspinu/Dropbox/dev/iroll/src/tmp.cpp:6:23: required from here
/usr/include/c++/7/bits/stl_algobase.h:200:15: error: ambiguous overload for ‘operator<’ (operand types are ‘const cpp11::r_bool’ and ‘const cpp11::r_bool’)
if (__b < __a)
~~~~^~~~~
/usr/include/c++/7/bits/stl_algobase.h:200:15: note: candidate: operator<(int, int) <built-in>
/usr/include/c++/7/bits/stl_algobase.h:200:15: note: candidate: operator<(Rboolean, Rboolean) <built-in>
/home/vspinu/bin/R-4.1.2-bin/etc/Makeconf:177: recipe for target '/home/vspinu/Dropbox/dev/iroll/src/tmp.o' failed
make: *** [/home/vspinu/Dropbox/dev/iroll/src/tmp.o] Error 1
In file included from /usr/include/c++/7/algorithm:61:0,
from /home/vspinu/.lib/4.1.2/cpp11/include/cpp11/logicals.hpp:3,
from /home/vspinu/Dropbox/dev/iroll/src/tmp.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h: In instantiation of ‘const _Tp& std::min(const _Tp&, const _Tp&) [with _Tp = cpp11::r_bool]’:
/home/vspinu/Dropbox/dev/iroll/src/tmp.cpp:6:23: required from here
/usr/include/c++/7/bits/stl_algobase.h:200:15: error: ambiguous overload for ‘operator<’ (operand types are ‘const cpp11::r_bool’ and ‘const cpp11::r_bool’)
if (__b < __a)
~~~~^~~~~
/usr/include/c++/7/bits/stl_algobase.h:200:15: note: candidate: operator<(int, int) <built-in>
/usr/include/c++/7/bits/stl_algobase.h:200:15: note: candidate: operator<(Rboolean, Rboolean) <built-in>
make: *** [/home/vspinu/Dropbox/dev/iroll/src/tmp.o] Error 1
Matrix products: default
BLAS: /home/vspinu/bin/R-4.1.2-bin/lib/libRblas.so
LAPACK: /home/vspinu/bin/R-4.1.2-bin/lib/libRlapack.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8
[4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=de_DE.UTF-8 LC_MESSAGES=C
[7] LC_PAPER=de_DE.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] cpp11_0.4.2
loaded via a namespace (and not attached):
[1] compiler_4.1.2
</details>
- Ngôn ngữ chính
- C++
- Star
- 224
- Fork
- 52
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của r-lib/cpp11
-
Dimension error with `r_vector` Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 42/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
AXERA-TECH/ax-llm#77 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
games-on-whales/wolf#509 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
-
bug-unconfirmed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100