summaryrefslogtreecommitdiff
path: root/test/SemaTemplate
Commit message (Collapse)AuthorAgeFilesLines
* Remove the -cxx-abi command-line flag.Hans Wennborg2014-01-145-10/+10
| | | | | | | | | | | | | | | This makes the C++ ABI depend entirely on the target: MS ABI for -win32 triples, Itanium otherwise. It's no longer possible to do weird combinations. To be able to run a test with a specific ABI without constraining it to a specific triple, new substitutions are added to lit: %itanium_abi_triple and %ms_abi_triple can be used to get the current target triple adjusted to the desired ABI. For example, if the test suite is running with the i686-pc-win32 target, %itanium_abi_triple will expand to i686-pc-mingw32. Differential Revision: http://llvm-reviews.chandlerc.com/D2545 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199250 91177308-0d34-0410-b5e6-96231b3b80d8
* There is no such thing as __attribute__((align)); that's a __declspec ↵Aaron Ballman2014-01-131-1/+1
| | | | | | attribute. Fixing these test cases to use the proper spelling for their syntax. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199141 91177308-0d34-0410-b5e6-96231b3b80d8
* Update tests in preparation for using the MS ABI for Win32 targetsHans Wennborg2014-01-135-9/+33
| | | | | | | | | | In preparation for making the Win32 triple imply MS ABI mode, make all tests pass in this mode, or make them use the Itanium mode explicitly. Differential Revision: http://llvm-reviews.chandlerc.com/D2401 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199130 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the appropriate SourceLocation for the template backtrace when doingNick Lewycky2014-01-117-18/+15
| | | | | | | template argument deduction. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198995 91177308-0d34-0410-b5e6-96231b3b80d8
* PR18246: When performing template argument deduction to decide which templateRichard Smith2013-12-141-0/+19
| | | | | | | | | | | is specialized by an explicit specialization, start from the first declaration in case we've got a member of a class template (redeclarations might not number the template parameters the same way). Our recover here is still far from ideal. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197305 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Don't require -re suffix on -verify directives with regexes."Alp Toker2013-12-146-8/+8
| | | | | | | | | | This patch was submitted to the list for review and didn't receive a LGTM. (In fact one explicit objection and one query were raised.) This reverts commit r197295. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197299 91177308-0d34-0410-b5e6-96231b3b80d8
* PR18232: implement instantiation for class-scope explicit specializations ofRichard Smith2013-12-141-0/+49
| | | | | | | class templates (a Microsoft extension). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197298 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't require -re suffix on -verify directives with regexes.Hans Wennborg2013-12-146-8/+8
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D2392 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197295 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a testcase and a FIXME for an accepts-invalid.Richard Smith2013-12-131-8/+19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197280 91177308-0d34-0410-b5e6-96231b3b80d8
* Detabify and fix formatting.Richard Smith2013-12-131-67/+40
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197279 91177308-0d34-0410-b5e6-96231b3b80d8
* Tighten test regexes checking for __attribute__((thiscall)) on function types.Hans Wennborg2013-12-133-3/+3
| | | | | | | | | | | The tests were perhaps made too relaxed in r197164 when we switched to the new MinGW ABI. This makes sure we check explicitly for an optional thiscall attribute and nothing else. We should still look into whether we should print these attributes at all in these cases. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197252 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch to the new MingW ABI.Rafael Espindola2013-12-123-3/+3
| | | | | | | GCC 4.7 changed the MingW ABI. On the clang side this means that methods now have the thiscall calling convention by default. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197164 91177308-0d34-0410-b5e6-96231b3b80d8
* Change semantics of regex expectations in the diagnostic verifierHans Wennborg2013-12-113-5/+5
| | | | | | | | | | | | | | | | | | | | | | | Previously, a line like // expected-error-re {{foo}} treats the entirety of foo as a regex. This is inconvenient when matching type names containing regex characters. For example, to match "void *(class test8::A::*)(void)" inside such a regex, one would have to type "void \*\(class test8::A::\*\)\(void\)". This patch changes the semantics of expected-error-re to only treat the parts of the directive wrapped in double curly braces as regexes. This avoids the escaping problem and leads to nicer patterns for those cases; see e.g. the change to test/Sema/format-strings-scanf.c. (The balanced search for closing }} of a directive also makes us handle the full directive in test\SemaCXX\constexpr-printing.cpp:41 and :53.) Differential Revision: http://llvm-reviews.chandlerc.com/D2388 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197092 91177308-0d34-0410-b5e6-96231b3b80d8
* Sema: Enforce C++11 pointer-to-member template arguments should rulesDavid Majnemer2013-12-101-1/+8
| | | | | | | | | | | | | The standard is pretty clear on what it allows inside of template arguments for non-type template parameters of pointer-to-member. They must be of the form &qualified-id and cannot come from sources like constexpr VarDecls or things of that nature. This fixes PR18192. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196852 91177308-0d34-0410-b5e6-96231b3b80d8
* Give a more appropriate diagnostic when a template specialization orRichard Smith2013-12-071-1/+1
| | | | | | | | instantiation appears in a non-enclosing namespace (the previous diagnostic talked about the C++98 rule even in C++11 mode). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196642 91177308-0d34-0410-b5e6-96231b3b80d8
* PR18152: When computing the semantic form for an initializer list, keep trackRichard Smith2013-12-061-0/+7
| | | | | | | of whether the initializer list is dependent. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196558 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a tranche of comment, test and doc typosAlp Toker2013-12-051-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196510 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a return statement to the func with an int return type.Kaelyn Uhrain2013-11-281-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195897 91177308-0d34-0410-b5e6-96231b3b80d8
* Sema: Instantiation of variable definitions weren't local enoughDavid Majnemer2013-11-271-0/+20
| | | | | | | | | | | | We wouldn't properly save and restore the pending local instantiations we had built up prior to instantiation of a variable definition. This would lead to us instantiating too much causing crashes and other general badness. This fixes PR14374. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195887 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema] Don't look for the instantiation of a local extern decl in a differentArgyrios Kyrtzidis2013-11-271-0/+25
| | | | | | | | dependent context that the one we are instantiating, otherwise there will be an assertion. rdar://15464547 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195828 91177308-0d34-0410-b5e6-96231b3b80d8
* Sema: Instantiate local class and their members appropriatelyDavid Majnemer2013-11-271-1/+95
| | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195827 91177308-0d34-0410-b5e6-96231b3b80d8
* PR10837: Warn if a null pointer constant is formed by a zero integer constantRichard Smith2013-11-211-0/+14
| | | | | | | | expression that is not a zero literal, in C. This is a different, and more targeted, approach than that in r194540. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195303 91177308-0d34-0410-b5e6-96231b3b80d8
* Extra test for r194444.Richard Smith2013-11-121-0/+12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194445 91177308-0d34-0410-b5e6-96231b3b80d8
* Issue a diagnostic if we see a templated friend declaration that we do notRichard Smith2013-11-081-5/+12
| | | | | | | support. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194273 91177308-0d34-0410-b5e6-96231b3b80d8
* Sema: Correctly build pointer-to-member arguments from a template argument ↵David Majnemer2013-10-261-0/+14
| | | | | | | | | | | | | with an IndirectFieldDecl We only considered FieldDecl and CXXMethodDecl as appropriate which would cause us to believe the IndirectFieldDecl corresponded to an argument of it's field type instead of a pointer-to-member type. This fixes PR17696. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193461 91177308-0d34-0410-b5e6-96231b3b80d8
* Sema: Allow IndirectFieldDecl to appear in a non-type template argumentDavid Majnemer2013-10-221-0/+4
| | | | | | | | | | | | We would not identify pointer-to-member construction in a non-type template argument if it was either a FieldDecl or a CXXMethodDecl. However, this would incorrectly reject declarations that were injected via an IndirectFieldDecl (e.g. a field inside of an anonymous union). This fixes PR17657. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193203 91177308-0d34-0410-b5e6-96231b3b80d8
* Sema: Do not allow template declarations inside local classesDavid Majnemer2013-10-222-105/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Enforce the rule in C++11 [temp.mem]p2 that local classes cannot have member templates. This fixes PR16947. N.B. C++14 has slightly different wording to afford generic lambdas declared inside of functions. Fun fact: Some formulations of local classes with member templates would cause clang to crash during Itanium mangling, such as the following: void outer_mem() { struct Inner { template <typename = void> struct InnerTemplateClass { static void itc_mem() {} }; }; Inner::InnerTemplateClass<>::itc_mem(); } Reviewers: eli.friedman, rsmith, doug.gregor, faisalv Reviewed By: doug.gregor CC: cfe-commits, ygao Differential Revision: http://llvm-reviews.chandlerc.com/D1866 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193144 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow CorrectTypo to replace CXXScopeSpecifiers that refer to classes.Kaelyn Uhrain2013-10-191-8/+8
| | | | | | | | | | | Now that CorrectTypo knows how to correctly search classes for typo correction candidates, there is no good reason to only replace an existing CXXScopeSpecifier if it refers to a namespace. While the actual enablement was a matter of changing a single comparison, the fallout from enabling the functionality required a lot more code changes (including my two previous commits). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193020 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix missed exception spec checks and crashesAlp Toker2013-10-181-0/+30
| | | | | | | | | | | | | | | | | | | Delayed exception specification checking for defaulted members and virtual destructors are both susceptible to mutation during iteration so we need to swap and process the worklists. This resolves both accepts-invalid and rejects-valid issues and moreover fixes potential invalid memory access as the contents of the vectors change during iteration and recursive template instantiation. Checking can be further delayed where parent classes aren't yet fully defined. This patch adds two assertions at end of TU to ensure no specs are left unchecked as was happenning before the fix, plus a test case from Marshall Clow for the defaulted member crash extracted from the libcxx headers. Reviewed by Richard Smith. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192947 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Fix missed exception spec checks and crashes"Alp Toker2013-10-171-30/+0
| | | | | | | | | | | The changes caused the sanitizer bot to hang: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/2311 Needs investigation. This reverts commit r192914. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192921 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix missed exception spec checks and crashesAlp Toker2013-10-171-0/+30
| | | | | | | | | | | | | | | | | | Delayed exception specification checking for defaulted members and virtual destructors are both susceptible to mutation during iteration so we need to process the worklists fully. This resolves both accepts-invalid and rejects-valid issues and moreover fixes potential invalid memory access as the contents of the vectors change during iteration and recursive template instantiation. This patch also adds two assertions at end of TU to ensure no specs are left unchecked as was happenning before the fix, plus a test case from Marshall Clow for the defaulted member crash extracted from the libcxx headers. Reviewed by Richard Smith. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192914 91177308-0d34-0410-b5e6-96231b3b80d8
* ms-compat: Fix taking the address of a member of a dependent baseReid Kleckner2013-10-151-0/+40
| | | | | | | | | | | | | | | | | | | | | | If unqualified id lookup fails while parsing a class template with a dependent base, clang with -fms-compatibility will pretend the user prefixed the name with 'this->' in order to delay the lookup. However, if there was a unary ampersand, Sema::ActOnDependentIdExpression() will create a DependentDeclRefExpr, which is not what we wanted at all. Fix this by building the CXXDependentScopeMemberExpr directly instead. In order to be fully MSVC compatible, we would have to defer all attempts at name lookup to instantiation time. However, until we have real problems with system headers that can't be parsed, we'll put off implementing that. Fixes PR16014. Reviewers: rsmith Differential Revision: http://llvm-reviews.chandlerc.com/D1892 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192727 91177308-0d34-0410-b5e6-96231b3b80d8
* PR17567: Improve diagnostic for a mistyped constructor name. If we see somethingRichard Smith2013-10-151-2/+1
| | | | | | | | | | | | that looks like a function declaration, except that it's missing a return type, try typo-correcting it to the relevant constructor name. In passing, fix a bug where the missing-type-specifier recovery codepath would drop a preceding scope specifier on the floor, leading to follow-on diagnostics and incorrect recovery for the auto-in-c++98 hack. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192644 91177308-0d34-0410-b5e6-96231b3b80d8
* Variable templates: handle instantiation of static data member templatesRichard Smith2013-09-271-0/+30
| | | | | | | appropriately, especially when they appear within class templates. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191548 91177308-0d34-0410-b5e6-96231b3b80d8
* If a partial specialization of a member template is declared within a classRichard Smith2013-09-261-0/+23
| | | | | | | | | | template and defined outside it, don't instantiate it twice when instantiating the surrounding class template specialization. That would cause us to reject the code because we think two partial specializations instantiated to produce the same signature. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191418 91177308-0d34-0410-b5e6-96231b3b80d8
* Use -fms-compatibility to trigger lookup into dep. basesReid Kleckner2013-09-201-1/+1
| | | | | | | Update the docs for -fms-extensions and -fms-compatibility to try to clarify the difference between the two. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191095 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix crash with cast of value-dependent expr.Eli Friedman2013-09-191-0/+7
| | | | | | | | | We don't really need to perform semantic analysis on the dependent expression anyway, so just call the cast dependent. <rdar://problem/15012610> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190981 91177308-0d34-0410-b5e6-96231b3b80d8
* Added regression tests.Serge Pavlov2013-09-111-0/+13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190531 91177308-0d34-0410-b5e6-96231b3b80d8
* Ignore noreturn when checking function template specializationsReid Kleckner2013-09-101-0/+8
| | | | | | | | | | As requested when applying the same logic to calling conventions. Reviewers: rsmith Differential Revision: http://llvm-reviews.chandlerc.com/D1634 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190441 91177308-0d34-0410-b5e6-96231b3b80d8
* Sema: Subst type default template args earlierDavid Majnemer2013-08-282-8/+51
| | | | | | | | | | | | | | | | | Summary: We would not perform substitution at an appropriate point, allowing strange results to appear. We would accepts things that we shouldn't or mangle things incorrectly. Note that this hasn't fixed the other cases like template-template parameters or non-type template parameters. Reviewers: doug.gregor, rjmccall, rsmith Reviewed By: rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1507 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189540 91177308-0d34-0410-b5e6-96231b3b80d8
* Richard makes a good point, clean up this test.David Majnemer2013-08-281-8/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189444 91177308-0d34-0410-b5e6-96231b3b80d8
* Some of this test doesn't want -std=c++11David Majnemer2013-08-281-1/+6
| | | | | | | Sorry for the churn. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189429 91177308-0d34-0410-b5e6-96231b3b80d8
* This test now needs C++11David Majnemer2013-08-281-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189425 91177308-0d34-0410-b5e6-96231b3b80d8
* AST: Don't treat a TemplateExpansion as a TemplateDavid Majnemer2013-08-281-0/+11
| | | | | | | | | | | | | | | | | | | Summary: Instead of calling getAsTemplate(), call getAsTemplateOrTemplatePattern() because it handles the TemplateExpansion case too. This fixes PR16997. Reviewers: doug.gregor, rsmith Reviewed By: rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1512 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189422 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix name lookup with dependent using decls.Eli Friedman2013-08-201-0/+24
| | | | | | | | | | We previously mishandled UnresolvedUsingValueDecls in NamedDecl::declarationReplaces, which caused us to forget decls when there are multiple dependent using decls for the same name. Fixes PR16936. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188737 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix for dependent contexts in alias templates.Eli Friedman2013-08-151-0/+12
| | | | | | | | | | When we are parsing a type for an alias template, we are not entering the context, so we can't look into dependent classes. Make sure the parser handles this correctly. PR16904. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188510 91177308-0d34-0410-b5e6-96231b3b80d8
* Properly track l-paren of a CXXFucntionalCastExpr.Eli Friedman2013-08-151-0/+15
| | | | | | | | | | In addition to storing more useful information in the AST, this fixes a semantic check in template instantiation which checks whether the l-paren location is valid. Fixes PR16903. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188495 91177308-0d34-0410-b5e6-96231b3b80d8
* sizeof(void) etc. should be a hard error in C++.Eli Friedman2013-08-132-3/+3
| | | | | | PR16872. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188324 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix to PR16225 (Assert-on-invalid: isa<LabelDecl>(D) && "declaration not ↵Serge Pavlov2013-08-101-0/+13
| | | | | | | | | instantiated in this scope") Differential Revision: http://llvm-reviews.chandlerc.com/D920 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188137 91177308-0d34-0410-b5e6-96231b3b80d8
* Correctly profile CXXPseudoDestructorExprs.Eli Friedman2013-08-091-1/+7
| | | | | | CXXPseudoDestructorExprs may not contain a type. PR16852. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188123 91177308-0d34-0410-b5e6-96231b3b80d8