| 1 |
// { dg-do compile } |
| 2 |
module asm1; |
| 3 |
|
| 4 |
void parse1() |
| 5 |
{ |
| 6 |
asm |
| 7 |
{ |
| 8 |
""h; // { dg-error "found 'h' when expecting ':'" } |
| 9 |
} |
| 10 |
} |
| 11 |
|
| 12 |
void parse2() |
| 13 |
{ |
| 14 |
asm |
| 15 |
{ |
| 16 |
"" : : "g" (1 ? 2 : 3); |
| 17 |
"" : : "g" (1 ? 2 : :) 3; |
| 18 |
// { dg-error "expression expected, not ':'" "" { target *-*-* } .-1 } |
| 19 |
// { dg-error "expected constant string constraint for operand" "" { target *-*-* } .-2 } |
| 20 |
} |
| 21 |
} |
| 22 |
|
| 23 |
void parse3() |
| 24 |
{ |
| 25 |
asm { "" [; } |
| 26 |
// { dg-error "expression expected, not ';'" "" { target *-*-* } .-1 } |
| 27 |
// { dg-error "found 'End of File' when expecting ','" "" { target *-*-* } .-2 } |
| 28 |
// { dg-error "found 'End of File' when expecting ']'" "" { target *-*-* } .-3 } |
| 29 |
// { dg-error "found 'End of File' when expecting ';'" "" { target *-*-* } .-4 } |
| 30 |
} |
| 31 |
|
| 32 |
void parse4() |
| 33 |
{ |
| 34 |
int expr; |
| 35 |
asm |
| 36 |
{ |
| 37 |
"%name" : [name] string (expr); // { dg-error "expected constant string constraint for operand, not 'string'" } |
| 38 |
} |
| 39 |
} |
| 40 |
|
| 41 |
void semantic1() |
| 42 |
{ |
| 43 |
{ |
| 44 |
int one; |
| 45 |
L1: |
| 46 |
; |
| 47 |
} |
| 48 |
asm { "" : : : : L1, L2; } |
| 49 |
// { dg-error "'goto' skips declaration of variable 'asm1.semantic1.one'" "" { target *-*-* } .-1 } |
| 50 |
// { dg-error "'goto' skips declaration of variable 'asm1.semantic1.two'" "" { target *-*-* } .-2 } |
| 51 |
{ |
| 52 |
int two; |
| 53 |
L2: |
| 54 |
; |
| 55 |
} |
| 56 |
} |
| 57 |
|
| 58 |
void semantic2a(X...)(X expr) |
| 59 |
{ |
| 60 |
alias X[0] var1; |
| 61 |
asm { "%0" : "=m" (var1); } // { dg-error "cannot modify type 'double'" } |
| 62 |
} |
| 63 |
|
| 64 |
void semantic2() |
| 65 |
{ |
| 66 |
semantic2a(3.6); // { dg-error "template instance 'asm1.semantic2a!double' error instantiating" } |
| 67 |
} |
| 68 |
|
| 69 |
void semantic3() |
| 70 |
{ |
| 71 |
asm |
| 72 |
{ |
| 73 |
unknown; // { dg-error "undefined identifier 'unknown'" } |
| 74 |
} |
| 75 |
} |
| 76 |
|
| 77 |
struct S4 |
| 78 |
{ |
| 79 |
template opDispatch(string Name, P...) |
| 80 |
{ |
| 81 |
static void opDispatch(P) {} |
| 82 |
} |
| 83 |
} |
| 84 |
|
| 85 |
void semantic4() |
| 86 |
{ |
| 87 |
asm |
| 88 |
{ |
| 89 |
"%0" : : "m" (S4.foo); // { dg-error "template instance 'opDispatch!\"foo\"' has no value" } |
| 90 |
} |
| 91 |
} |