- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
#include <CL/sycl.hpp>
#include <iostream>
#include <memory>
class A {
public:
int v = 0;
virtual void func() {};
};
class B : public A {
public:
virtual void func() override {
std::cout << 1 << std::endl;
std::cout << this << std::endl;
std::cout << reinterpret_cast<unsigned int>(this) << std::endl;
}
};
class C : public A {
public:
virtual void func() override {
std::cout << 2 << std::endl;
std::cout << this << std::endl;
std::cout << reinterpret_cast<unsigned int>(this) << std::endl;
}
};
int main()
{
//auto ptr = std::make_shared<B>();
std::shared_ptr<A> ptr = std::make_shared<B>();
std::shared_ptr<A> ptr2 = std::make_shared<C>();
/*auto ptr = std::make_shared<B>();
auto ptr2 = std::make_shared<C>();*/
std::cout << reinterpret_cast<unsigned int>(ptr.get()) << std::endl;
ptr->func();
std::cout << reinterpret_cast<unsigned int>(ptr2.get()) << std::endl;
ptr2->func();
return 0;
}
code above can be compiled by using other c++ compiler,
I use DPC++ 2023 +vs2022
however DPC++2022 +vs2019 is ok
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm sorry .
code above CAN NOT be compiled by using other c++ compiler, return error: error: 14;
I use DPC++ 2023 +vs2022
however, DPC++2022 +vs2019 is ok
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for posting in Intel Communities.
Based on our internal discussion about creating a priority ticket if needed, I am going ahead and closing this case for now.
Please feel free to contact us further if you need any assistance from our side.
Thanks & Regards,
Vankudothu Vaishnavi.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I’m sorry, seems you didn't solve this problem ,why close it?

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page