aboutsummaryrefslogtreecommitdiff
path: root/test/SemaTemplate/instantiate-expr-1.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-03-13 23:49:33 +0000
committerDouglas Gregor <dgregor@apple.com>2009-03-13 23:49:33 +0000
commitbc736fceca6f0bca31d16003a7587857190408fb (patch)
tree795b52807b846a35f25bf0ea3bc6e0edd1671f32 /test/SemaTemplate/instantiate-expr-1.cpp
parent4db938ceb72dbaa5f7b50f6420a72629acbf29eb (diff)
Implement template instantiation for the prefix unary operators. As
always, refactored the existing logic to tease apart the parser action and the semantic analysis shared by the parser and template instantiation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66987 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaTemplate/instantiate-expr-1.cpp')
-rw-r--r--test/SemaTemplate/instantiate-expr-1.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/SemaTemplate/instantiate-expr-1.cpp b/test/SemaTemplate/instantiate-expr-1.cpp
index 869d558e33..2ea0641b00 100644
--- a/test/SemaTemplate/instantiate-expr-1.cpp
+++ b/test/SemaTemplate/instantiate-expr-1.cpp
@@ -53,3 +53,19 @@ void test_BitfieldDep() {
(void)sizeof(BitfieldDep<int, 1, 5>);
}
+template<int I>
+struct BitfieldNeg {
+ int bitfield : (-I); // expected-error{{bit-field 'bitfield' has negative width (-5)}}
+};
+
+template<typename T, T I>
+struct BitfieldNeg2 {
+ int bitfield : (-I); // expected-error{{bit-field 'bitfield' has negative width (-5)}}
+};
+
+void test_BitfieldNeg() {
+ (void)sizeof(BitfieldNeg<-5>); // okay
+ (void)sizeof(BitfieldNeg<5>); // expected-note{{in instantiation of template class 'struct BitfieldNeg<5>' requested here}}
+ (void)sizeof(BitfieldNeg2<int, -5>); // okay
+ (void)sizeof(BitfieldNeg2<int, 5>); // expected-note{{in instantiation of template class 'struct BitfieldNeg2<int, 5>' requested here}}
+}