blob: 9e234caa9c8dff5c00d7b579359f4555a14f6a95 [file] [log] [blame]
Sunil Srivastava780e5012015-07-14 18:08:50 +00001// RUN: %clang_cc1 -triple i686 -fsyntax-only -verify %s
2// RUN: %clang_cc1 -triple x86_64 -fsyntax-only -verify %s
3
4
5// this template, when instantiated with 300, violates the range contraint
6template <int N> void test(int value)
7{
8 asm("rol %1, %0" :"=r"(value): "I"(N + 1)); // expected-error{{value '301' out of range for constraint 'I'}}
9}
10
11int main() { test<300>(10); } // expected-note{{in instantiation of function template specialization 'test<300>' requested here}}
12
13
14// this template is not used, but the error is detectable
15template <int N> void testb(int value)
16{
17 asm("rol %1, %0" :"=r"(value): "I"(301)); // expected-error{{value '301' out of range for constraint 'I'}}
18}
19
20// these should compile without error
21template <int N> void testc(int value)
22{
23 asm("rol %1, %0" :"=r"(value): "I"(N + 1));
24}
25int foo() { testc<2>(10); }
Jennifer Yub8fee672019-06-03 15:57:25 +000026
27// these should compile without error
28template <int N> bool testd()
29{
30 __asm goto ("" : : : : lab);
31 return true;
32lab:
33 return false;
34}
35bool foox() { return testd<0> (); }