summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaTemplate/resolve-single-template-id.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix crash and rejects-valid when a later template parameter or defaultRichard Smith2019-06-201-0/+12
| | | | | | | | | | | | | | | | | | | | template argument contains a backreference to a dependently-typed earlier parameter. In a case like: template<typename T, T A, decltype(A) = A> struct X {}; template<typename U> auto Y = X<U, 0>(); we previously treated both references to `A` in the third parameter as being of type `int` when checking the template-id in `Y`. That`s wrong; the type of `A` in these contexts is the dependent type `U`. When we encounter a non-type template argument that we can't convert to the parameter type because of type-dependence, we now insert a dependent conversion node so that the SubstNonTypeTemplateParmExpr for the template argument will have the parameter's type rather than whatever type the argument had. llvm-svn: 363972
* Move the warning about unused relational comparison from -Wunused-value toRichard Trieu2014-03-111-2/+2
| | | | | | | -Wunused-comparison. Also, newly warn on unused result from overloaded relational comparisons, now also in -Wunused-comparison. llvm-svn: 203535
* PR16074, implement warnings to catch pointer to boolean true and pointer toRichard Trieu2014-02-261-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | null comparison when the pointer is known to be non-null. This catches the array to pointer decay, function to pointer decay and address of variables. This does not catch address of function since this has been previously used to silence a warning. Pointer to bool conversion is under -Wbool-conversion. Pointer to null comparison is under -Wtautological-pointer-compare, a sub-group of -Wtautological-compare. void foo() { int arr[5]; int x; // warn on these conditionals if (foo); if (arr); if (&x); if (foo == null); if (arr == null); if (&x == null); if (&foo); // no warning } llvm-svn: 202216
* sizeof(void) etc. should be a hard error in C++.Eli Friedman2013-08-131-1/+1
| | | | | | PR16872. llvm-svn: 188324
* Bound member function diagnostic - suggest no-args calls and note overload ↵David Blaikie2013-06-041-1/+1
| | | | | | | | | | candidates Still missing cases for templates, but this is a step in the right direction. Also omits suggestions that would be ambiguous (eg: void func(int = 0); + void func(float = 0); func;) llvm-svn: 183173
* Add notes for suppressing and (if it's a zero-arg function returning bool) ↵David Blaikie2011-12-091-2/+2
| | | | | | fixing the function-to-bool conversion warning. llvm-svn: 146280
* Add a warning for implicit conversion from function literals (and staticLang Hames2011-12-051-2/+2
| | | | | | | | | | | | | methods) to bool. E.g. void foo() {} if (f) { ... // <- Warns here. } Only applies to non-weak functions, and does not apply if the function address is taken explicitly with the addr-of operator. llvm-svn: 145849
* Update all tests other than Driver/std.cpp to use -std=c++11 rather thanRichard Smith2011-10-131-1/+1
| | | | | | -std=c++0x. Patch by Ahmed Charles! llvm-svn: 141900
* Catch placeholder types in DefaultLvalueConversionJohn McCall2011-10-111-13/+13
| | | | | | | | | | | and DefaultFunctionArrayLvalueConversion. To prevent significant regression for should-this-be-a-call fixits, and to repair some such regression from the introduction of bound member placeholders, make those placeholder checks try to build calls appropriately. Harden the build-a-call logic while we're at it. llvm-svn: 141738
* Treating the unused equality comparisons as something other than part ofChandler Carruth2011-08-171-4/+6
| | | | | | | | | | | | | | | | | | | | | -Wunused was a mistake. It resulted in duplicate warnings and lots of other hacks. Instead, this should be a special sub-category to -Wunused-value, much like -Wunused-result is. Moved to -Wunused-comparison, moved the implementation to piggy back on the -Wunused-value implementation instead of rolling its own, different mechanism for catching all of the "interesting" statements. I like the unused-value mechanism for this better, but its currently missing several top-level statements. For now, I've FIXME-ed out those test cases. I'll enhance the generic infrastructure to catch these statements in a subsequent patch. This patch also removes the cast-to-void fixit hint. This hint isn't available on any of the other -Wunused-value diagnostics, and if we want it to be, we should add it generically rather than in one specific case. llvm-svn: 137822
* Simplify calling CheckPlaceholderExpr, converge on it in a few places,John McCall2011-04-101-2/+2
| | | | | | and move a vector-splat check to follow l-value conversion. llvm-svn: 129254
* Basic, untested implementation for an "unknown any" type requested by LLDB.John McCall2011-04-071-7/+7
| | | | | | | | | | | | The idea is that you can create a VarDecl with an unknown type, or a FunctionDecl with an unknown return type, and it will still be valid to access that object as long as you explicitly cast it at every use. I'm still going back and forth about how I want to test this effectively, but I wanted to go ahead and provide a skeletal implementation for the LLDB folks' benefit and because it also improves some diagnostic goodness for placeholder expressions. llvm-svn: 129065
* Clean up our handling of template-ids that resolve down to a singleDouglas Gregor2011-03-161-0/+80
overload, so that we actually do the resolution for full expressions and emit more consistent, useful diagnostics. Also fixes an IRGen crasher, where Sema wouldn't diagnose a resolvable bound member function template-id used in a full-expression (<rdar://problem/9108698>). llvm-svn: 127747
OpenPOWER on IntegriCloud