summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/temp/temp.spec/temp.expl.spec
Commit message (Collapse)AuthorAgeFilesLines
* [Sema] Fixes templated friend member assertionMark de Wever2019-11-051-1/+10
| | | | | | Fixes PR41792: Clang assertion failure on templated friend member function Differential Revision: https://reviews.llvm.org/D69481
* Implement C++ DR727, which permits explicit specializations at class scope.Richard Smith2018-03-163-70/+17
| | | | | | | | | More generally, this permits a template to be specialized in any scope in which it could be defined, so this also supersedes DR44 and DR374 (the latter of which we previously only implemented in C++11 mode onwards due to unclarity as to whether it was a DR). llvm-svn: 327705
* When producing a name of a partial specialization in a diagnostic, use theRichard Smith2016-12-241-4/+4
| | | | | | | template arguments as written rather than the canonical template arguments, so we print more user-friendly names for template parameters. llvm-svn: 290483
* Fix all tests under test/CXX (and test/Analysis) to pass if clang's defaultRichard Smith2016-08-311-3/+15
| | | | | | C++ language standard is not C++98. llvm-svn: 280309
* DR259: Demote the pedantic error for an explicit instantiation after anRichard Smith2016-08-311-10/+10
| | | | | | | | | explicit specialization to a warning for C++98 mode (this is a defect report resolution, so per our informal policy it should apply in C++98), and turn the warning on by default for C++11 and later. In all cases where it fires, the right thing to do is to remove the pointless explicit instantiation. llvm-svn: 280308
* Lit C++11 Compatibility Patch #7Charles Li2016-04-132-19/+71
| | | | | | | 13 tests have been updated for C++11 compatibility. Differential Revision: http://reviews.llvm.org/D19068 llvm-svn: 266239
* Clean up variable template handling a bit, and correct the behavior of nameRichard Smith2014-01-161-1/+41
| | | | | | lookup when declaring a variable template specialization. llvm-svn: 199438
* Give a more appropriate diagnostic when a template specialization orRichard Smith2013-12-072-2/+2
| | | | | | | instantiation appears in a non-enclosing namespace (the previous diagnostic talked about the C++98 rule even in C++11 mode). llvm-svn: 196642
* Bug fix: disallow a variable template to be redeclared as a non-templated ↵Larisse Voufo2013-08-141-2/+1
| | | | | | variable llvm-svn: 188350
* Started implementing variable templates. Top level declarations should be ↵Larisse Voufo2013-08-061-1/+2
| | | | | | fully supported, up to some limitations documented as FIXMEs or TODO. Static data member templates work very partially. Static data member templates of class templates need particular attention... llvm-svn: 187762
* Add test for PR12938, fixed by Richard Smith in r172691David Blaikie2013-01-171-0/+5
| | | | llvm-svn: 172697
* Prior to adding the new "expected-no-diagnostics" directive to ↵Andy Gibbs2012-10-193-0/+3
| | | | | | VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. llvm-svn: 166280
* Allow CorrectTypo to add/modify nested name qualifiers to typos thatKaelyn Uhrain2012-06-061-2/+6
| | | | | | | | | are otherwise too short to try to correct. The TODOs added to two of the tests are for existing deficiencies in the typo correction code that could be exposed by using longer identifiers. llvm-svn: 158109
* hopefully fix a bunch of ARM buildbot failuresNuno Lopes2012-05-091-1/+1
| | | | llvm-svn: 156513
* PR12500: Improve the wording of the diagnostic for a redefinition of a nameRichard Smith2012-04-132-6/+6
| | | | | | in the wrong namespace scope. Patch by Jonathan Sauer! llvm-svn: 154656
* Fix "note" of a duplicate explicit instantiation definition following a ↵Nico Weber2012-01-091-9/+6
| | | | | | specialization. llvm-svn: 147798
* 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
* 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
* 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
* Fix an incorrect warning about explicit template specializations forDouglas Gregor2011-06-011-0/+31
| | | | | | nested types, from Michael Han! llvm-svn: 132431
* 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
* 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
* 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
* 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-071-0/+63
| | | | | | | | | | | 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
* When diagnosing C++ [temp.expl.spec]p3 in C++98/03 mode, downgrade theDouglas Gregor2010-09-122-7/+246
| | | | | | | | | | | error to a warning if we're in a case that would be allowed in C++0x. This "fixes" PR8084 by making Clang accept more code than GCC and (non-strict) EDG do. Also, add the missing test case for the C++0x semantics, which should have been in r113717. llvm-svn: 113718
* Support friend function specializations.John McCall2010-03-241-1/+1
| | | | llvm-svn: 99389
* An explicit specialization is allowed following an explicitDouglas Gregor2010-02-261-0/+7
| | | | | | | instantiation so long as that explicit specialization was declared previously. Fixes PR6160. llvm-svn: 97210
* Permit the use of typedefs of class template specializations inDouglas Gregor2010-02-131-2/+13
| | | | | | | qualified declarator-ids. This patch is actually due to Cornelius; fixes PR6179. llvm-svn: 96082
* Improve the reporting of non-viable overload candidates by noting the reasonJohn McCall2010-01-131-1/+1
| | | | | | | | why the candidate is non-viable. There's a lot we can do to improve this, but it's a good start. Further improvements should probably be integrated with the bad-initialization reporting routines. llvm-svn: 93277
* Improve the diagnostics used to report implicitly-generated class membersJohn McCall2010-01-062-3/+3
| | | | | | | | | as parts of overload sets. Also, refer to constructors as 'constructors' rather than functions. Adjust a lot of tests. llvm-svn: 92832
* Switch default-initialization of variables of class type (or array thereof) ↵Douglas Gregor2009-12-202-3/+3
| | | | | | over to InitializationSequence. I could swear that this fixes a PR somewhere, but I couldn't figure out which one llvm-svn: 91796
* Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar2009-12-1518-18/+18
| | | | | | | | | - This is designed to make it obvious that %clang_cc1 is a "test variable" which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it can be useful to redefine what gets run as 'clang -cc1' (for example, to set a default target). llvm-svn: 91446
* Diagnose the use of typedefs for template specialization types in the scopeJohn McCall2009-12-151-0/+12
| | | | | | | | specifiers for out-of-line declarations, e.g. typedef Temp<int> MyTemp; template <> MyTemp::foo; llvm-svn: 91395
* Add additional note to mark the cause of synthesized constructors. MarkEli Friedman2009-11-091-1/+1
| | | | | | | declaration invalid if the constructor can't be properly built. Addresses remaining review comments from Fariborz for r86500. llvm-svn: 86579
* Unify the codepaths used to verify base and member initializers for explicitlyEli Friedman2009-11-091-3/+2
| | | | | | | | | | | | | | | | and implicitly defined constructors. This has a number of benefits: 1. Less code. 2. Explicit and implicit constructors get the same diagnostics. 3. The AST explicitly contains constructor calls from implicit default constructors. This allows handing some cases that previously weren't handled correctly in IRGen without any additional code. Specifically, implicit default constructors containing calls to constructors with default arguments are now handled correctly. llvm-svn: 86500
* Eliminate &&s in tests.Daniel Dunbar2009-11-081-1/+1
| | | | | | - 'for i in $(find . -type f); do sed -e 's#\(RUN:.*[^ ]\) *&& *$#\1#g' $i | FileUpdate $i; done', for the curious. llvm-svn: 86430
* Improve diagnostics when parsing something likeDouglas Gregor2009-10-301-2/+1
| | | | | | | | template<> struct foo<int> { ... }; where "foo" does not refer to a template. Fixes PR3844. llvm-svn: 85616
* Unify our diagnostic printing for errors of the form, "we didn't likeDouglas Gregor2009-10-131-3/+3
| | | | | | | | | | what we found when we looked into <blah>", where <blah> is a DeclContext*. We can now format DeclContext*'s in nice ways, e.g., "namespace N", "the global namespace", "'class Foo'". This is part of PR3990, but we're not quite there yet. llvm-svn: 84028
* Diagnose attempts to add default function arguments to aDouglas Gregor2009-10-131-0/+30
| | | | | | specialization. This completes C++ [temp.expl.spec]! llvm-svn: 83980
* When explicitly specializing a member that is a template, mark theDouglas Gregor2009-10-132-1/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | template as a specialization. For example, this occurs with: template<typename T> struct X { template<typename U> struct Inner { /* ... */ }; }; template<> template<typename T> struct X<int>::Inner { T member; }; We need to treat templates that are member specializations as special in two contexts: - When looking for a definition of a member template, we look through the instantiation chain until we hit the primary template *or a member specialization*. This allows us to distinguish between the primary "Inner" definition and the X<int>::Inner definition, above. - When computing all of the levels of template arguments needed to instantiate a member template, don't add template arguments from contexts outside of the instantiation of a member specialization, since the user has already manually substituted those arguments. Fix up the existing test for p18, which was actually wrong (but we didn't diagnose it because of our poor handling of member specializations of templates), and add a new test for member specializations of templates. llvm-svn: 83974
* Improve the internal representation and semantic analysis of friendDouglas Gregor2009-10-131-0/+14
| | | | | | | | | | | | | | | function templates. This commit ensures that friend function templates are constructed as FunctionTemplateDecls rather than partial FunctionDecls (as they previously were). It then implements template instantiation for friend function templates, injecting the friend function template only when no previous declaration exists at the time of instantiation. Oh, and make sure that explicit specialization declarations are not friends. llvm-svn: 83970
* When declaring a class template whose name is qualified, make sureDouglas Gregor2009-10-121-0/+16
| | | | | | | | that the scope in which it is being declared is complete. Also, when instantiating a member class template's ClassTemplateDecl, be sure to delay type creation so that the resulting type is dependent. Ick. llvm-svn: 83923
* Test explicit specialization involving multiple template<> headersDouglas Gregor2009-10-121-0/+12
| | | | llvm-svn: 83914
* Permit explicit specialization of member functions of class templatesDouglas Gregor2009-10-121-0/+26
| | | | | | | | that are declarations (rather than definitions). Also, be sure to set the access specifiers properly when instantiating the declarations of member function templates. llvm-svn: 83911
* Test explicit specializations of static data members that are declarations, ↵Douglas Gregor2009-10-121-0/+22
| | | | | | not definitions llvm-svn: 83904
* Yet another test for explicit specialization, this one involving linkageDouglas Gregor2009-10-121-0/+42
| | | | llvm-svn: 83901
OpenPOWER on IntegriCloud