xref: /llvm-project/clang/test/SemaCUDA/constexpr-virtual-func.cu (revision 1c999072221371c9008cd0aec80e387777378de0)
1 // RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -fsyntax-only \
2 // RUN:            -fcuda-is-device %s
3 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only %s
4 
5 // expected-no-diagnostics
6 
7 #include "Inputs/cuda.h"
8 
9 class A
10 {
11 public:
12     constexpr virtual int f() = 0;
13 };
14 
15 class B : public A
16 {
17 public:
18     int f() override
19     {
20         return 42;
21     }
22 };
23 
24 int test()
25 {
26     B b;
27     return b.f();
28 }
29