summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2012-04-09 16:37:11 +0000
committerDavid Blaikie <dblaikie@gmail.com>2012-04-09 16:37:11 +0000
commit80cdddc5046d4a0cd02a2a19cfb9ce70c3890c09 (patch)
treec6ec392466b8b72aea79b6802cd689a09fda0416 /clang/test
parente6b6fae8ffdbaa38bf88a0d5d207c02df3ab22c5 (diff)
downloadbcm5719-llvm-80cdddc5046d4a0cd02a2a19cfb9ce70c3890c09.tar.gz
bcm5719-llvm-80cdddc5046d4a0cd02a2a19cfb9ce70c3890c09.zip
Fix bugs found by -Wconstant-conversion improvements currently under review.
Specifically, using a an integer outside [0, 1] as a boolean constant seems to be an easy mistake to make with things like "x == a || b" where the author intended "x == a || x == b". The bug caused by calling SkipUntil with three token kinds was also identified by a VC diagnostic & reported by Francois Pichet as review feedback for my commit r154163. I've included test cases to verify the error recovery that was broken/poorly implemented due to this bug. The other fix (lib/Sema/SemaExpr.cpp) seems like that code was never actually reached in any of Clang's tests & is related to Objective C features I'm not familiar with, so I've not been able to construct a test case for it. Perhaps someone else can. llvm-svn: 154325
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Parser/cxx-template-decl.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/test/Parser/cxx-template-decl.cpp b/clang/test/Parser/cxx-template-decl.cpp
index be1f81e9d15..7e931a31fa2 100644
--- a/clang/test/Parser/cxx-template-decl.cpp
+++ b/clang/test/Parser/cxx-template-decl.cpp
@@ -9,6 +9,13 @@ export template<class T> class x0; // expected-warning {{exported templates are
template < ; // expected-error {{expected template parameter}} \
// expected-error{{expected ',' or '>' in template-parameter-list}} \
// expected-warning {{declaration does not declare anything}}
+template <int +> struct x1; // expected-error {{expected ',' or '>' in template-parameter-list}}
+
+// verifies that we only walk to the ',' & still produce errors on the rest of the template parameters
+template <int +, T> struct x2; // expected-error {{expected ',' or '>' in template-parameter-list}} \
+ expected-error {{expected unqualified-id}}
+template<template<int+>> struct x3; // expected-error {{expected ',' or '>' in template-parameter-list}} \
+ expected-error {{template template parameter requires 'class' after the parameter list}}
template <template X> struct Err1; // expected-error {{expected '<' after 'template'}} \
// expected-error{{extraneous}}
template <template <typename> > struct Err2; // expected-error {{template template parameter requires 'class' after the parameter list}}
OpenPOWER on IntegriCloud