1// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=clc++ -pedantic -verify -fsyntax-only 2 3// This test checks that various C/C++/OpenCL C constructs are not available in 4// C++ for OpenCL. 5 6// Test that typeid is not available. 7namespace std { 8 // Provide a dummy std::type_info so that we can use typeid. 9 class type_info { 10 int a; 11 }; 12} 13__constant std::type_info int_ti = typeid(int); 14// expected-error@-1 {{'typeid' is not supported in C++ for OpenCL}} 15 16// Test that dynamic_cast is not available in C++ for OpenCL. 17class A { 18public: 19 int a; 20}; 21 22class B : public A { 23 int b; 24}; 25 26B *test_dynamic_cast(B *p) { 27 return dynamic_cast<B *>(p); 28 // expected-error@-1 {{'dynamic_cast' is not supported in C++ for OpenCL}} 29} 30 31// Test storage class qualifiers. 32__constant _Thread_local int a = 1; 33// expected-error@-1 {{C++ for OpenCL version 1.0 does not support the '_Thread_local' storage class specifier}} 34// expected-warning@-2 {{'_Thread_local' is a C11 extension}} 35// expected-error@-3 {{thread-local storage is not supported for the current target}} 36__constant __thread int b = 2; 37// expected-error@-1 {{C++ for OpenCL version 1.0 does not support the '__thread' storage class specifier}} 38// expected-error@-2 {{thread-local storage is not supported for the current target}} 39kernel void test_storage_classes() { 40 register int x; 41 // expected-error@-1 {{C++ for OpenCL version 1.0 does not support the 'register' storage class specifier}} 42 thread_local int y; 43 // expected-error@-1 {{C++ for OpenCL version 1.0 does not support the 'thread_local' storage class specifier}} 44 // expected-error@-2 {{thread-local storage is not supported for the current target}} 45} 46