File tree Expand file tree Collapse file tree 4 files changed +22
-6
lines changed Expand file tree Collapse file tree 4 files changed +22
-6
lines changed Original file line number Diff line number Diff line change @@ -11426,7 +11426,7 @@ def warn_oss_section_is_char : Warning<"array section %select{lower bound|length
11426
11426
def err_oss_single_decl_in_task : Error<
11427
11427
"single declaration is expected after 'task' directive">;
11428
11428
def err_oss_function_expected : Error<
11429
- "'#pragma oss task' can only be applied to %select{ functions|non-volatile or static methods}0 ">;
11429
+ "'#pragma oss task' can only be applied to functions">;
11430
11430
def err_oss_non_void_task : Error<
11431
11431
"non-void tasks are not supported">;
11432
11432
def err_oss_rvalue_param_task : Error<
Original file line number Diff line number Diff line change @@ -461,6 +461,9 @@ Parser::DeclGroupPtrTy Parser::ParseOmpSsDeclarativeDirectiveWithExtDecl(
461
461
462
462
switch (DKind) {
463
463
case OSSD_task: {
464
+ // Only allowed in C++ mode
465
+ if (!getLangOpts ().CPlusPlus && getCurScope ()->isClassScope ())
466
+ break ;
464
467
// The syntax is:
465
468
// { #pragma oss task }
466
469
// <function-declaration-or-definition>
Original file line number Diff line number Diff line change @@ -20,4 +20,17 @@ void foo7(int *p) {}
20
20
#pragma oss task reduction(+: *p) weakreduction(+: *p) // expected-error {{unexpected OmpSs-2 clause 'reduction' in directive '#pragma oss task'}} expected-error {{unexpected OmpSs-2 clause 'weakreduction' in directive '#pragma oss task'}}
21
21
void foo8 (int * p ) {}
22
22
23
+ struct S0 {
24
+ // expected-error@+2 {{field 'foo' declared as a function}}
25
+ #pragma oss task
26
+ void foo ();
27
+ };
28
+
29
+ struct S1 {
30
+ // expected-error@+3 {{field 'bar' declared as a function}}
31
+ // expected-error@+2 {{expected ';' at end of declaration list}}
32
+ #pragma oss task
33
+ void bar () {}
34
+ };
35
+
23
36
#pragma oss task // expected-error {{function declaration is expected after 'task' function directive}}
Original file line number Diff line number Diff line change 1
1
// RUN: %clang_cc1 -verify -x c++ -fompss-2 -ferror-limit 100 -o - %s
2
2
3
3
struct S {
4
- // expected-error@+2 {{'#pragma oss task' can only be applied to non-volatile or static methods }}
4
+ // expected-error@+2 {{'#pragma oss task' can only be applied to functions }}
5
5
#pragma oss task in(*p)
6
6
virtual void foo (int *p) {}
7
7
};
8
8
9
9
struct P : S {
10
10
P () {};
11
- // expected-error@+2 {{'#pragma oss task' can only be applied to non-volatile or static methods }}
11
+ // expected-error@+2 {{'#pragma oss task' can only be applied to functions }}
12
12
#pragma oss task in(*p)
13
13
P (int *p) {}
14
- // expected-error@+2 {{'#pragma oss task' can only be applied to non-volatile or static methods }}
14
+ // expected-error@+2 {{'#pragma oss task' can only be applied to functions }}
15
15
#pragma oss task
16
16
~P () {}
17
- // expected-error@+2 {{'#pragma oss task' can only be applied to non-volatile or static methods }}
17
+ // expected-error@+2 {{'#pragma oss task' can only be applied to functions }}
18
18
#pragma oss task
19
19
P& operator =(const P &) {}
20
- // expected-error@+2 {{'#pragma oss task' can only be applied to non-volatile or static methods }}
20
+ // expected-error@+2 {{'#pragma oss task' can only be applied to functions }}
21
21
#pragma oss task in(*p)
22
22
void foo (int *p) {}
23
23
#pragma oss task
You can’t perform that action at this time.
0 commit comments