1780e5018SSunil Srivastava // RUN: %clang_cc1 -triple i686 -fsyntax-only -verify %s 2780e5018SSunil Srivastava // RUN: %clang_cc1 -triple x86_64 -fsyntax-only -verify %s 3780e5018SSunil Srivastava 4780e5018SSunil Srivastava 5780e5018SSunil Srivastava // this template, when instantiated with 300, violates the range contraint test(int value)6780e5018SSunil Srivastavatemplate <int N> void test(int value) 7780e5018SSunil Srivastava { 8780e5018SSunil Srivastava asm("rol %1, %0" :"=r"(value): "I"(N + 1)); // expected-error{{value '301' out of range for constraint 'I'}} 9780e5018SSunil Srivastava } 10780e5018SSunil Srivastava main()11780e5018SSunil Srivastavaint main() { test<300>(10); } // expected-note{{in instantiation of function template specialization 'test<300>' requested here}} 12780e5018SSunil Srivastava 13780e5018SSunil Srivastava 14780e5018SSunil Srivastava // this template is not used, but the error is detectable testb(int value)15780e5018SSunil Srivastavatemplate <int N> void testb(int value) 16780e5018SSunil Srivastava { 17780e5018SSunil Srivastava asm("rol %1, %0" :"=r"(value): "I"(301)); // expected-error{{value '301' out of range for constraint 'I'}} 18780e5018SSunil Srivastava } 19780e5018SSunil Srivastava 20780e5018SSunil Srivastava // these should compile without error testc(int value)21780e5018SSunil Srivastavatemplate <int N> void testc(int value) 22780e5018SSunil Srivastava { 23780e5018SSunil Srivastava asm("rol %1, %0" :"=r"(value): "I"(N + 1)); 24780e5018SSunil Srivastava } foo()25780e5018SSunil Srivastavaint foo() { testc<2>(10); } 26*b8fee677SJennifer Yu 27*b8fee677SJennifer Yu // these should compile without error testd()28*b8fee677SJennifer Yutemplate <int N> bool testd() 29*b8fee677SJennifer Yu { 30*b8fee677SJennifer Yu __asm goto ("" : : : : lab); 31*b8fee677SJennifer Yu return true; 32*b8fee677SJennifer Yu lab: 33*b8fee677SJennifer Yu return false; 34*b8fee677SJennifer Yu } foox()35*b8fee677SJennifer Yubool foox() { return testd<0> (); } 36