summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/temp
Commit message (Collapse)AuthorAgeFilesLines
...
* C++11 [temp.deduct.call]p6 tweak: when given a set of overlaodedDouglas Gregor2012-03-121-1/+16
| | | | | | | | | functions that includes an explicit template argument list, perform an inner deduction against each of the function templates in that list and, if successful, use the result of that deduction for the outer template argument deduction. Fixes PR11713. llvm-svn: 152575
* When template argument deduction is ignoring qualifiers, perform deepDouglas Gregor2012-03-111-0/+8
| | | | | | | | structural comparison of non-dependent types. Otherwise, we end up rejecting cases where the non-dependent types don't match due to qualifiers in, e.g., a pointee type. Fixes PR12132. llvm-svn: 152529
* Improve diagnostics a bit for bad member initializers, and fix an obscure ↵Eli Friedman2012-02-221-0/+10
| | | | | | bug involving packs. Fixes PR12049. llvm-svn: 151130
* Represent C++ direct initializers as ParenListExprs before semantic analysisSebastian Redl2012-02-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | instead of having a special-purpose function. - ActOnCXXDirectInitializer, which was mostly duplication of AddInitializerToDecl (leading e.g. to PR10620, which Eli fixed a few days ago), is dropped completely. - MultiInitializer, which was an ugly hack I added, is dropped again. - We now have the infrastructure in place to distinguish between int x = {1}; int x({1}); int x{1}; -- VarDecl now has getInitStyle(), which indicates which of the above was used. -- CXXConstructExpr now has a flag to indicate that it represents list- initialization, although this is not yet used. - InstantiateInitializer was renamed to SubstInitializer and simplified. - ActOnParenOrParenListExpr has been replaced by ActOnParenListExpr, which always produces a ParenListExpr. Placed that so far failed to convert that back to a ParenExpr containing comma operators have been fixed. I'm pretty sure I could have made a crashing test case before this. The end result is a (I hope) considerably cleaner design of initializers. More importantly, the fact that I can now distinguish between the various initialization kinds means that I can get the tricky generalized initializer test cases Johannes Schaub supplied to work. (This is not yet done.) This commit passed self-host, with the resulting compiler passing the tests. I hope it doesn't break more complicated code. It's a pretty big change, but one that I feel is necessary. llvm-svn: 150318
* When a pack expansion occurs in the template argument list of an aliasDouglas Gregor2012-02-031-0/+7
| | | | | | | | template without a corresponding parameter pack, don't immediately substitute the alias template. This is under discussion in the C++ committee, and may become ill-formed, but for now we match GCC. llvm-svn: 149697
* Implement support for a pack expansion into a fixed-lengthDouglas Gregor2012-02-031-0/+120
| | | | | | | | | template. Such pack expansions can easily fail at template instantiation time, if the expanded parameter packs are of the wrong length. Fixes <rdar://problem/10040867>, PR9021, and the example that came up today at Going Native. llvm-svn: 149685
* Fix "note" of a duplicate explicit instantiation definition following a ↵Nico Weber2012-01-091-9/+6
| | | | | | specialization. llvm-svn: 147798
* Tweak the fix to PR8977: an empty expression-list represents value ↵Eli Friedman2012-01-051-1/+2
| | | | | | initialization, not default initialization. Fixes PR11712. llvm-svn: 147620
* Change the diagnostics which said 'accepted as an extension' to instead sayRichard Smith2011-12-291-4/+5
| | | | | | | 'is an extension'. The former is inappropriate and confusing when building with -Werror/-pedantic-errors. llvm-svn: 147357
* Fix several issues related to specializations and explicit instantiations.Nico Weber2011-12-231-0/+128
| | | | | | | | | | | | | | | Explicit instantiations following specializations are no-ops and hence have no PointOfInstantiation. That was done correctly in most cases, but for a specialization -> instantiation decl -> instantiation definition chain, the definition didn't realize that it was a no-op. Fix that. Also, when printing diagnostics for these no-ops, get the diag location from the decl name location. Add many test cases, one of them not yet passing (but it failed the same way before this change). Fixes http://llvm.org/pr11558 and more. llvm-svn: 147225
* Fix a crash on invalid, http://llvm.org/pr11599Nico Weber2011-12-201-0/+7
| | | | llvm-svn: 146988
* Remove a non-gcc-compatible extension that would apply attributes on ↵Eli Friedman2011-12-171-2/+1
| | | | | | declarations without a declarator to structs. Add a warning for ignored attributes. Patch by Michael Han. llvm-svn: 146796
* Some tests missed from r144056.Richard Smith2011-11-082-0/+48
| | | | llvm-svn: 144060
* Make the -Wc++11-compat warnings ignored by default, so we don't breakDouglas Gregor2011-10-253-3/+3
| | | | | | | valid C++98/03 code. However, add these warnings to -Wall, for those who obviously already like clean code. llvm-svn: 142903
* Fix grammar for C++11 alignment specifiers, and add a few FIXMEs.Peter Collingbourne2011-10-231-1/+2
| | | | llvm-svn: 142760
* Diagnose unexpanded parameter packs in member initialisers (includingPeter Collingbourne2011-10-231-0/+6
| | | | | | in-class member initialisers). llvm-svn: 142758
* 'extern template' is a C++11 feature. Add an Extension for C++98 (this matchesRichard Smith2011-10-201-1/+1
| | | | | | gcc's behaviour), and a -Wc++98-compat-pedantic warning for C++11. llvm-svn: 142597
* Fix pr9789, assert-on-invalid while instantiating an (invalid) class ↵David Blaikie2011-10-191-1/+2
| | | | | | template with a non-final parameter pack. Also improve the warning for non-final parameter packs in this scenario so it only fires once, rather than once for every template parameter after the non-final parameter pack. llvm-svn: 142473
* [temp.explicit]p1: constexpr cannot be specified in explicit instantiations.Richard Smith2011-10-141-2/+7
| | | | llvm-svn: 141982
* Update all tests other than Driver/std.cpp to use -std=c++11 rather thanRichard Smith2011-10-1348-48/+48
| | | | | | -std=c++0x. Patch by Ahmed Charles! llvm-svn: 141900
* When we determine that a function template specialization produced asDouglas Gregor2011-10-121-2/+3
| | | | | | | | | | | | | | | part of template argument deduction is ill-formed, we mark it as invalid and treat it as a deduction failure. If we happen to find that specialization again, treat it as a deduction failure rather than silently building a call to the declaration. Fixes PR11117, a marvelous bug where deduction failed after creating an invalid specialization, causing overload resolution to pick a different candidate. Then we performed a similar overload resolution later, and happily picked the invalid specialization to call... resulting in a silent link failure. llvm-svn: 141809
* Switch diagnostic text from "C++0x" over to "C++11".Douglas Gregor2011-10-122-3/+3
| | | | | | | | We'd also like for "C++11" or "c++11" to be used for the warning groups, but without removing the old warning flags. Patches welcome; I've run out of time to work on this today. llvm-svn: 141801
* Catch placeholder types in DefaultLvalueConversionJohn McCall2011-10-111-3/+3
| | | | | | | | | | | 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
* When substituting into a sizeof parameter pack expression in a contextDouglas Gregor2011-10-101-0/+15
| | | | | | | where we can't expand (i.e., multi-level substitution), be sure to substitute the pack with its level-reduced pack. Fixes PR10230. llvm-svn: 141568
* Per the note in C++0x [temp.deduct.call]p4, don't attempt templateDouglas Gregor2011-10-091-0/+12
| | | | | | | argument deduction against a function parameter that has no deducible template parameters in it. Fixes PR8598. llvm-svn: 141517
* A friend template specialization is also dependent if any of itsDouglas Gregor2011-10-091-0/+24
| | | | | | template arguments are dependent. Fixes PR10913. llvm-svn: 141515
* Declare and define implicit move constructor and assignment operator.Sebastian Redl2011-08-301-0/+1
| | | | | | | | | This makes the code duplication of implicit special member handling even worse, but the cleanup will have to come later. For now, this works. Follow-up with tests for explicit defaulting and enabling the __has_feature flag to come. llvm-svn: 138821
* PR10359: Template declarations which define classes are not permitted to ↵Richard Smith2011-07-142-4/+24
| | | | | | | | | | | | also contain declarators. Previously we would accept code like this: template<typename T> struct S { } f() { return 0; } This case now produces a missing ';' diagnostic, since that seems like a much more likely error than an attempt to declare a function or variable in addition to the class template. Treat this llvm-svn: 135195
* Factor out (some of) the checking for invalid forms of pointerChandler Carruth2011-06-271-2/+2
| | | | | | | | | | | | | | | | | | | arithmetic into a couple of common routines. Use these to make the messages more consistent in the various contexts, especially in terms of consistently diagnosing binary operators with invalid types on both the left- and right-hand side. Also, improve the grammar and wording of the messages some, handling both two pointers and two (different) types. The wording of function pointer arithmetic diagnostics still strikes me as poorly phrased, and I worry this makes them slightly more awkward if more consistent. I'm hoping to fix that with a follow-on patch and test case that will also make them more helpful when a typedef or template type parameter makes the type completely opaque. Suggestions on better wording are very welcome, thanks to Richard Smith for some initial help on that front. llvm-svn: 133906
* Accept no-return stripping conversions for pointer type arguments afterChandler Carruth2011-06-181-1/+15
| | | | | | | | | | | | | | | | | | | deducing template parameter types. Recently Clang began enforcing the more strict checking that the argument type and the deduced function parameter type (after substitution) match, but that only consideres qualification conversions. One problem with this patch is that we check noreturn conversions and qualification conversions independently. If a valid conversion would require *both*, perhaps interleaved with each other, it will be rejected. If this actually occurs (I'm not yet sure it does) and is in fact a problem (I'm not yet sure it is), there is a FIXME to implement more intelligent conversion checking. However, this step at least allows Clang to resume accepting valid code we're seeing in the wild. llvm-svn: 133327
* Implement the consistency checking for C++ [temp.deduct.call]p3, whichDouglas Gregor2011-06-161-0/+9
| | | | | | | | | | | | | | | checks that the deduced argument type for a function call matches the actual argument type provided. The only place we've found where the consistency checking should actually cause template argument deduction failure is due to qualifier differences that don't fall into the realm of qualification conversions (which are *not* checked when we initially perform deduction). However, we're performing the full checking as specified in the standard to ensure that no other cases exist. Fixes PR9233 / <rdar://problem/9039590>. llvm-svn: 133163
* Downgrade the warning about the use of typedefs for class templateDouglas Gregor2011-06-071-2/+2
| | | | | | | | specializations within an explicit instantiation to default to off (enabled by -pedantic). Nobody else seem to implement C++ [temp.explicit]p3. Fixes PR10093. llvm-svn: 132704
* Diagnose the condition in C++ [temp.expl.spec]p16 that prohibitsDouglas Gregor2011-06-061-1/+13
| | | | | | | specializing a member of an unspecialized template, and recover from such errors without crashing. Fixes PR10024 / <rdar://problem/9509761>. llvm-svn: 132677
* When checking the instantiation of a default template argument againstDouglas Gregor2011-06-031-0/+9
| | | | | | | | | | | | | | | the template parameter, perform the checking as a "specified" template argument rather than a "deduced" template argument; the latter implies stricter type checking that is not permitted for default template arguments. Also, cleanup our handling of substitution of explicit template arguments for a function template. We were actually performing some substitution of default arguments at this point! Fixes PR10069. llvm-svn: 132529
* Fix an incorrect warning about explicit template specializations forDouglas Gregor2011-06-011-0/+31
| | | | | | nested types, from Michael Han! llvm-svn: 132431
* Diagnose unexpanded parameter packs in return statements. ThisDouglas Gregor2011-05-201-0/+7
| | | | | | | manifested in a crash with blocks in PR9953, but it was a ticking time bomb for normal functions, too. Fixes PR9953. llvm-svn: 131731
* When checking a set of template parameter lists against aDouglas Gregor2011-05-151-0/+10
| | | | | | | | | nested-name-specifier, re-evaluate the nested-name-specifier as if we were entering that context (which we did!), so that we'll resolve a template-id to a particular class template partial specialization. Fixes PR9913. llvm-svn: 131383
* Implement CWG1170, which makes access-control errors into templateDouglas Gregor2011-05-111-0/+41
| | | | | | | argument deduction failures. Only implemented in C++0x, since this is a significant change in behavior from C++98/03. llvm-svn: 131209
* When checking for the necessary 'template<>' headers based on theDouglas Gregor2011-05-113-0/+46
| | | | | | | | | | nested of an out-of-line declaration, only require a 'template<>' header for each enclosing class template that hasn't been previously specialized; previously, we were requiring 'template<>' for enclosing class templates and members of class templates that hadn't been previously specialized. Fixes <rdar://problem/9422013>. llvm-svn: 131207
* Reimplement Sema::MatchTemplateParametersToScopeSpecifier() based onDouglas Gregor2011-05-102-3/+169
| | | | | | | | | | | | | | | | | | the semantic context referenced by the nested-name-specifier rather than the syntactic form of the nested-name-specifier. The previous incarnation was based on my complete misunderstanding of C++ [temp.expl.spec]. The latest C++0x working draft clarifies the requirements here, and this rewrite is intended to follow that. Along the way, improve source location information in the diagnostics. For example, if we report that a specific type needs or doesn't need a 'template<>' header, we dig out that type in the nested-name-specifier and highlight its range. Fixes: PR5907, PR9421, PR8277, PR8708, PR9482, PR9668, PR9877, and <rdar://problem/9135379>. llvm-svn: 131138
* Slight tweak to alias template error handling: don't guess that a ↵Richard Smith2011-05-051-2/+1
| | | | | | template-id in an alias declaration was meant to be a specialization. Use a generic, but more accurate, diagnostic. llvm-svn: 130961
* Implement support for C++0x alias templates.Richard Smith2011-05-058-6/+165
| | | | llvm-svn: 130953
* When parsing a template friend declaration we dropped the templateChandler Carruth2011-05-031-1/+1
| | | | | | | | | | | | | | | | | | | | parameters on the floor in certain cases: class X { template <typename T> friend typename A<T>::Foo; }; This was parsed as a *non* template friend declaration some how, and received an ExtWarn. Fixing the parser to actually provide the template parameters to the freestanding declaration parse triggers the code which specifically looks for such constructs and hard errors on them. Along the way, this prevents us from trying to instantiate constructs like the above inside of a outer template. This is important as loosing the template parameters means we don't have a well formed declaration and template instantiation will be unable to rebuild the AST. That fixes a crash in the GCC test suite. llvm-svn: 130772
* Add support for C++0x's range-based for loops, as specified by the C++11 ↵Richard Smith2011-04-141-0/+4
| | | | | | draft standard (N3291). llvm-svn: 129541
* Template static data members can have weak_odr linkage, not justJohn McCall2011-04-121-4/+4
| | | | | | | | weak linkage. Also, fix a problem where global weak variables with non-trivial initializers were getting guard variables, or at least were checking for them and then crashing. llvm-svn: 129342
* Detect attempts to provide a specialization of a function within aDouglas Gregor2011-03-161-0/+12
| | | | | | dependent scope and produce an error (rather than crashing). Fixes PR8979. llvm-svn: 127749
* Clean up our handling of template-ids that resolve down to a singleDouglas Gregor2011-03-161-3/+3
| | | | | | | | | 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
* Revert r127206 "Detect attempts to provide a specialization of a function withinDaniel Dunbar2011-03-091-12/+0
| | | | | | a...", it appears to cause us to reject various valid codes. llvm-svn: 127373
* Detect attempts to provide a specialization of a function within aDouglas Gregor2011-03-081-0/+12
| | | | | | dependent scope and produce an error (rather than crashing). Fixes PR8979. llvm-svn: 127206
* Support explicit template specialization and instantiation for membersDouglas Gregor2011-03-072-0/+128
| | | | | | | | | | | of a C++0x inline namespace within enclosing namespaces, as noted in C++0x [namespace.def]p8. Fixes <rdar://problem/9006349>, a libc++ failure where Clang was rejected an explicit specialization of std::swap (since libc++ puts it into an inline, versioned namespace std::__1). llvm-svn: 127162
OpenPOWER on IntegriCloud