summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/temp/temp.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
* [c++20] Implement P0846R0: allow (ADL-only) calls to template-ids whoseRichard Smith2019-05-091-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | template name is not visible to unqualified lookup. In order to support this without a severe degradation in our ability to diagnose typos in template names, this change significantly restructures the way we handle template-id-shaped syntax for which lookup of the template name finds nothing. Instead of eagerly diagnosing an undeclared template name, we now form a placeholder template-name representing a name that is known to not find any templates. When the parser sees such a name, it attempts to disambiguate whether we have a less-than comparison or a template-id. Any diagnostics or typo-correction for the name are delayed until its point of use. The upshot should be a small improvement of our diagostic quality overall: we now take more syntactic context into account when trying to resolve an undeclared identifier on the left hand side of a '<'. In fact, this works well enough that the backwards-compatible portion (for an undeclared identifier rather than a lookup that finds functions but no function templates) is enabled in all language modes. llvm-svn: 360308
* P0859R0: List-initialization is potentially-constant-evaluated andRichard Smith2018-09-261-0/+12
| | | | | | | | | | | | triggers instantiation of constexpr functions. We mostly implemented this since Clang 6, but missed the template instantiation case. We do not implement the '&cast-expression' special case. It appears to be a mistake / oversight. I've mailed CWG to see if we can remove it. llvm-svn: 343064
* Implement C++ DR727, which permits explicit specializations at class scope.Richard Smith2018-03-164-75/+20
| | | | | | | | | 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
* Give more accurate descriptions of what kind of template we found in ↵Richard Smith2017-01-141-1/+1
| | | | | | | | | diagnostics. We were previouly assuming that every type template was a class template, which is not true any more. llvm-svn: 291988
* 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
* Make '-disable-llvm-optzns' an alias for '-disable-llvm-passes'.Chandler Carruth2016-12-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Much to my surprise, '-disable-llvm-optzns' which I thought was the magical flag I wanted to get at the raw LLVM IR coming out of Clang deosn't do that. It still runs some passes over the IR. I don't want that, I really want the *raw* IR coming out of Clang and I strongly suspect everyone else using it is in the same camp. There is actually a flag that does what I want that I didn't know about called '-disable-llvm-passes'. I suspect many others don't know about it either. It both does what I want and is much simpler. This removes the confusing version and makes that spelling of the flag an alias for '-disable-llvm-passes'. I've also moved everything in Clang to use the 'passes' spelling as it seems both more accurate (*all* LLVM passes are disabled, not just optimizations) and much easier to remember and spell correctly. This is part of simplifying how Clang drives LLVM to make it cleaner to wire up to the new pass manager. Differential Revision: https://reviews.llvm.org/D28047 llvm-svn: 290392
* Improve error message when referencing a non-tag type with a tagReid Kleckner2016-12-091-1/+1
| | | | | | | | | | | | | | | | | | | | Other compilers accept invalid code here that we reject, and we need a better error message to try to convince users that the code is really incorrect. Consider: class Foo { typedef MyIterHelper<Foo> iterator; friend class iterator; }; Previously our wording was "elaborated type refers to a typedef". "elaborated type" isn't widely known terminology, so the new diagnostic says "typedef 'iterator' cannot be referenced with class specifier". Reviewers: rsmith Differential Revision: https://reviews.llvm.org/D25216 llvm-svn: 289259
* 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-312-17/+18
| | | | | | | | | 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
* Implement C++17 P0386R2, inline variables. (The 'inline' specifier gives aRichard Smith2016-06-251-0/+10
| | | | | | | variable weak discardable linkage and partially-ordered initialization, and is implied for constexpr static data members.) llvm-svn: 273754
* Lit C++11 Compatibility Patch #8Charles Li2016-04-141-1/+28
| | | | | | 24 tests have been updated for C++11 compatibility. llvm-svn: 266387
* Lit C++11 Compatibility Patch #7Charles Li2016-04-134-22/+94
| | | | | | | 13 tests have been updated for C++11 compatibility. Differential Revision: http://reviews.llvm.org/D19068 llvm-svn: 266239
* [Lit Test] Updated 34 Lit tests to be C++11 compatible.Charles Li2015-11-171-0/+5
| | | | | | | Added expected diagnostics new to C++11. Expanded RUN line to: default, C++98/03 and C++11. llvm-svn: 253371
* C++1y is now C++14!Aaron Ballman2014-08-191-1/+1
| | | | | | Changes diagnostic options, language standard options, diagnostic identifiers, diagnostic wording to use c++14 instead of c++1y. It also modifies related test cases to use the updated diagnostic wording. llvm-svn: 215982
* Revert "clang/test/Driver/crash-report.c: This requires rewriter for ↵Alp Toker2014-07-162-2/+0
| | | | | | | | | | | | | | | | | | | | | -frewrite-includes. [PR20321]" We've decided to make the core rewriter class and PP rewriters mandatory. They're only a few hundred lines of code in total and not worth supporting as a distinct build configuration, especially since doing so disables key compiler features. This reverts commit r213150. Revert "clang/test: Introduce the feature "rewriter" for --enable-clang-rewriter." This reverts commit r213148. Revert "Move clang/test/Frontend/rewrite-*.c to clang/test/Frontend/Rewriter/" This reverts commit r213146. llvm-svn: 213159
* clang/test: Introduce the feature "rewriter" for --enable-clang-rewriter.NAKAMURA Takumi2014-07-162-0/+2
| | | | llvm-svn: 213148
* CodeGen: Fix linkage of reference temporariesDavid Majnemer2014-04-281-2/+2
| | | | | | | | | | | | | | | Summary: A reference temporary should inherit the linkage of the variable it initializes. Otherwise, we may hit cases where a reference temporary wouldn't have the same value in all translation units. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3515 llvm-svn: 207451
* Clean up variable template handling a bit, and correct the behavior of nameRichard Smith2014-01-162-4/+44
| | | | | | lookup when declaring a variable template specialization. llvm-svn: 199438
* Give a more appropriate diagnostic when a template specialization orRichard Smith2013-12-073-4/+4
| | | | | | | instantiation appears in a non-enclosing namespace (the previous diagnostic talked about the C++98 rule even in C++11 mode). llvm-svn: 196642
* Sema: Instantiate local class and their members appropriatelyDavid Majnemer2013-11-271-6/+5
| | | | | | | | | | | We would fail to instantiate them when the surrounding function was instantiated. Instantiate the class and add it's members to the list of pending instantiations, they should be resolved when we are finished with the function's body. This fixes PR9685. llvm-svn: 195827
* Fix accepts-invalid if a variable template explicit instantiation is missing anRichard Smith2013-09-181-1/+1
| | | | | | argument list, but could be instantiated with argument list of <>. llvm-svn: 190913
* Disable llvm optimizations, but keep -O1 to test available_externally.Rafael Espindola2013-09-041-1/+1
| | | | llvm-svn: 189919
* Bug fix: disallow a variable template to be redeclared as a non-templated ↵Larisse Voufo2013-08-142-3/+2
| | | | | | variable llvm-svn: 188350
* Started implementing variable templates. Top level declarations should be ↵Larisse Voufo2013-08-062-1/+39
| | | | | | 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
* Extend template instantiation bug fix (r184503) with fixit testLarisse Voufo2013-06-211-3/+11
| | | | llvm-svn: 184577
* Add basic fixit test to template instantiation bug fix (r184503)Larisse Voufo2013-06-211-0/+3
| | | | llvm-svn: 184559
* Bug Fix: Template explicit instantiations should not have definitions ↵Larisse Voufo2013-06-211-0/+52
| | | | | | (FixIts yet to be tested.) llvm-svn: 184503
* The 'constexpr implies const' rule for non-static member functions is gone inRichard Smith2013-04-211-1/+1
| | | | | | | | | C++1y, so stop adding the 'const' there. Provide a compatibility warning for code relying on this in C++11, with a fix-it hint. Update our lazily-written tests to add the const, except for those ones which were testing our implementation of this rule. llvm-svn: 179969
* Add test for PR12938, fixed by Richard Smith in r172691David Blaikie2013-01-171-0/+5
| | | | llvm-svn: 172697
* PR12008: defer adding the implicit 'const' to a constexpr member function untilRichard Smith2013-01-141-1/+1
| | | | | | we know whether it is static. llvm-svn: 172376
* Prior to adding the new "expected-no-diagnostics" directive to ↵Andy Gibbs2012-10-196-0/+6
| | | | | | 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
* Improve some of the conversion warnings to fire on conversion to bool.David Blaikie2012-05-151-1/+1
| | | | | | | | | | | Moves the bool bail-out down a little in SemaChecking - so now -Wnull-conversion and -Wliteral-conversion can fire when the target type is bool. Also improve the wording/details in the -Wliteral-conversion warning to match the -Wconstant-conversion. llvm-svn: 156826
* hopefully fix a bunch of ARM buildbot failuresNuno Lopes2012-05-092-2/+2
| | | | llvm-svn: 156513
* Change how we suppress access control in explicit instantiationsJohn McCall2012-05-071-3/+46
| | | | | | | | | | so that we actually accumulate all the delayed diagnostics. Do this so that we can restore those diagnostics to good standing if it turns out that we were wrong to suppress, e.g. if the tag specifier is actually an elaborated type specifier and not a declaration. llvm-svn: 156291
* 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
* Enable warn_impcast_literal_float_to_integer by default.David Blaikie2012-04-051-2/+3
| | | | | | | | | | | | | | | | | This diagnostic seems to be production ready, it's just an oversight that it wasn't turned on by default. The test changes are a bit of a mixed bag. Some tests that seemed like they clearly didn't need to use this behavior have been modified not to use it. Others that I couldn't be sure about, I added the necessary expected-warnings to. It's possible the diagnostic message could be improved to make it clearer that this warning can be suppressed by using a value that won't lose precision when converted to the target type (but can still be a floating point literal, such as "bool b = 1.0;"). llvm-svn: 154068
* Support for definitions of member enumerations of class templates outside theRichard Smith2012-03-231-0/+9
| | | | | | | class template's definition, and for explicit specializations of such enum members. llvm-svn: 153304
* Instantiating a class template should not instantiate the definition of anyRichard Smith2012-03-142-5/+122
| | | | | | | | scoped enumeration members. Later uses of an enumeration temploid as a nested name specifier should cause its instantiation. Plus some groundwork for explicit specialization of member enumerations of class templates. llvm-svn: 152750
* 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
* Fix a crash on invalid, http://llvm.org/pr11599Nico Weber2011-12-201-0/+7
| | | | llvm-svn: 146988
* 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
* '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
* [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-135-5/+5
| | | | | | -std=c++0x. Patch by Ahmed Charles! llvm-svn: 141900
* 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
* 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
OpenPOWER on IntegriCloud