Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Call resolution for functions with template and overloaded implementations

Đang mở
#3,240 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
cpp
Lĩnh vực
compilers

Hướng nghiên cứu

Bắt đầu với reproducer ISPC trong issue hoặc liên kết Compiler Explorer của nó, tập trung vào việc phân giải overload cho same và việc khởi tạo template trong foo. So sánh các chẩn đoán hiện tại cho các overload uniform và varying, sau đó xác định và xác minh hành vi phân giải được mong đợi cho trường hợp này.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Frontend / Parser Templates

Consider the following code:

uniform int same(uniform int x) { return x + 2; }
varying int same(varying int x) { return x + 3; }

template <typename T>
uniform T same(uniform T a) {
    uniform T result;
    foreach (i = 0 ... 4) {
        result[i] = same(a[i]);
    }
    return result + 5;
}

uniform int foo(uniform int x) { return same(x); }
uniform int<4> foo(uniform int<4> x) { return same(x); }

the compiler reports an error:

<source>:8:9: Error: Trying to index into non-array, vector, or 
        pointer type "uniform int32". 
        result[i] = same(a[i]);
        ^^^^^^^^^

<source>:8:26: Error: Trying to index into non-array, vector, or 
        pointer type "uniform int32". 
        result[i] = same(a[i]);
                         ^^^^

Compiler returned: 1

It looks like the compiler is trying to instantiate the template with uniform int as T, even though there is already an implementation for it. I am not quite sure how the compiler should behave in this situation.

Compiler explorer link https://ispc.godbolt.org/z/MbYn9edP8

Ngôn ngữ chính
C++
Star
3k
Fork
361
Merge trung bình
23 giờ 6 phút
Pull request đã merge (30 ngày)
43

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ispc/ispc

Tất cả issue của ispc/ispc

Issue tương tự

Thêm issue về C++

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.