summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/basic
Commit message (Collapse)AuthorAgeFilesLines
* Lit C++11 Compatibility Patch #8Charles Li2016-04-141-3/+14
| | | | | | 24 tests have been updated for C++11 compatibility. llvm-svn: 266387
* [Lit Test] Updated 34 Lit tests to be C++11 compatible.Charles Li2015-11-173-4/+27
| | | | | | | Added expected diagnostics new to C++11. Expanded RUN line to: default, C++98/03 and C++11. llvm-svn: 253371
* [Sema] main can't be declared as global variable, in C++.Davide Italiano2015-08-141-0/+66
| | | | | | | | | | | So, we now reject that. We also warn for any external-linkage global variable named main in C, because it results in undefined behavior. PR: 24309 Differential Revision: http://reviews.llvm.org/D11658 Reviewed by: rsmith llvm-svn: 245051
* [Sema] Don't crash if array bound calculation overflowed constexpr arrayDavid Majnemer2015-04-181-0/+2
| | | | | | | | | We didn't correctly expect a QualifiedTypeLoc when faced with fixing a variable array type into a constant array type. Differential Revision: http://reviews.llvm.org/D8958 llvm-svn: 235251
* Update error message text.Serge Pavlov2015-01-181-1/+1
| | | | | | | | | Previously if an enumeration was used in a nested name specifier in pre-C++11 language dialect, error message was 'XXX is not a class, namespace, or scoped enumeration'. This patch removes the word 'scoped' as in C++11 any enumeration may be used in this context. llvm-svn: 226410
* DR1684: a constexpr member function need not be a member of a literal class ↵Richard Smith2014-12-161-6/+5
| | | | | | type. llvm-svn: 224388
* Revert "clang/test/Driver/crash-report.c: This requires rewriter for ↵Alp Toker2014-07-161-1/+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-161-0/+1
| | | | llvm-svn: 213148
* Don't accept qualified 'int' main return types in C++ or standard C modeAlp Toker2014-07-021-0/+2
| | | | | | | | | C++ [basic.start.main]p1: "It shall have a return type of type int" ISO C is also clear about this, so only accept 'int' with qualifiers in GNUMode C. llvm-svn: 212171
* The exception-declaration for a function-try-block cannot redeclare aAaron Ballman2014-06-022-4/+14
| | | | | | | function parameter. One of our existing test cases was XFAILed because of this. This fixes the issue and un-XFAILs the test. llvm-svn: 210026
* This test should no longer be XFAILed; the standard has stabilized, and the ↵Aaron Ballman2014-05-301-13/+12
| | | | | | test contents are acceptable. No diagnostics expected from this test. llvm-svn: 209891
* Test requires exceptionsAlp Toker2014-05-281-1/+1
| | | | | | It's still XFAIL, but slightly closer to passing. llvm-svn: 209729
* Sema: Implement DR244David Majnemer2014-05-211-1/+2
| | | | | | | | | | | | | | | | Summary: Naming the destructor using a typedef-name for the class-name is well-formed. This fixes PR19620. Reviewers: rsmith, doug.gregor Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3583 llvm-svn: 209319
* Revert "Sema: Implement DR244"David Majnemer2014-05-031-2/+1
| | | | | | | | This was accidentally committed. This reverts commit r207892. llvm-svn: 207893
* Sema: Implement DR244David Majnemer2014-05-031-1/+2
| | | | | | | | | Naming the destructor using a typedef-name for the class-name is well-formed. This fixes PR19620. llvm-svn: 207892
* Don't fold together the name lookup entries for two declarations if they areRichard Smith2014-03-171-0/+11
| | | | | | declared in different namespaces in the same inline namespace set. llvm-svn: 204082
* Improve diagnostic for using non-class/namespace/scoped enum in a nested ↵David Blaikie2014-02-091-1/+2
| | | | | | | | | | | | | | | name specifier. Rather than simply saying "X is not a class or namespace", clarify what X is by providing the aka type in the case where X is a type, or pointing to the named declaration if there's an unambiguous one to refer to. In the ambiguous case, the ambiguities are already enumerated (though could be clarified by describing what kind of entities they are) Included a few FIXMEs in tests where some further improvements could be made. llvm-svn: 201038
* Add implicit declarations of allocation functions when looking them up forRichard Smith2014-02-042-2/+4
| | | | | | | | redeclaration, not just when looking them up for a use -- we need the implicit declaration to appropriately check various properties of them (notably, whether they're deleted). llvm-svn: 200729
* Add a test file missed from r199782.Richard Smith2014-01-221-0/+24
| | | | llvm-svn: 199783
* Added warning on structures/unions that are empty or contain onlySerge Pavlov2013-11-141-1/+1
| | | | | | | | | | bit fields of zero size. Warnings are generated in C++ mode and if only such type is defined inside extern "C" block. The patch fixed PR5065. Differential Revision: http://llvm-reviews.chandlerc.com/D2151 llvm-svn: 194653
* PR17731: When determining whether a tag and a non-tag were declared in the sameRichard Smith2013-10-301-0/+45
| | | | | | | scope, be careful about function-scope declarations (which are not declared in their semantic context). llvm-svn: 193671
* Teach typo correction to look inside of classes like it does namespaces.Kaelyn Uhrain2013-09-261-4/+4
| | | | | | | | | | | | | | | Unlike with namespaces, searching inside of classes requires also checking the access to correction candidates (i.e. don't suggest a correction to a private class member for a correction occurring outside that class and its methods or friends). Included is a small (one line) fix for a bug, that was uncovered while cleaning up the unit tests, where the decls from a TypoCorrection candidate were preserved in new TypoCorrection candidates that are derived (copied) from the old TypoCorrection--notably when creating a new candidate by changing the NestedNameSpecifier associated with the base idenitifer. llvm-svn: 191449
* Switch the semantic DeclContext for a block-scope declaration of a function orRichard Smith2013-09-201-0/+73
| | | | | | | | | | | | | | variable from being the function to being the enclosing namespace scope (in C++) or the TU (in C). This allows us to fix a selection of related issues where we would build incorrect redeclaration chains for such declarations, and fail to notice type mismatches. Such declarations are put into a new IdentifierNamespace, IDNS_LocalExtern, which is only found when searching scopes, and not found when searching DeclContexts. Such a declaration is only made visible in its DeclContext if there are no non-LocalExtern declarations. llvm-svn: 191064
* Fix implementation of C11 6.2.7/4 and C++11 [dcl.array]p3:Richard Smith2013-08-131-26/+27
| | | | | | | | | | | | | When a local extern declaration redeclares some other entity, the type of that entity is merged with the prior type if the prior declaration is visible (in C) or is declared in the same scope (in C++). - Make LookupRedeclarationWithLinkage actually work in C++, use it in the right set of cases, and make it track whether it found a shadowed declaration. - Track whether we found a declaration in the same scope (for C++) including across serialization and template instantiation. llvm-svn: 188307
* Sema: Do not merge new decls with invalid, old declsDavid Majnemer2013-07-071-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Sema::MergeFunctionDecl attempts merging two decls even if the old decl is invalid. This can lead to interesting circumstances where we successfully merge the decls but the result makes no sense. Take the following for example: template <typename T> int main(void); int main(void); Sema will not consider these to be overloads of the same name because main can't be overloaded, which means that this must be a redeclaration. In this case the templated decl is compatible with the non-templated decl allowing the Sema::CheckFunctionDeclaration machinery to move on and do bizarre things like setting the previous decl of a non-templated decl to a templated decl! The way I see it, we should just bail from MergeFunctionDecl if the old decl is invalid. This fixes PR16531. llvm-svn: 185779
* Sema: Fix a crash when main is redeclared as a function-template.David Majnemer2013-07-061-0/+9
| | | | | | | | | | This boils down to us sending invalid function decls to CheckFunctionDeclaration becauswe we did not consider that CheckMain could cause the decl to be invalid. Instead, interogate the new decl's main-validity and *then* send it over to get CheckFunctionDeclaration'd if it was still valid after calling CheckMain. llvm-svn: 185745
* C++1y constexpr extensions, round 1: Allow most forms of declaration andRichard Smith2013-04-221-2/+12
| | | | | | | | statement in constexpr functions. Everything which doesn't require variable mutation is also allowed as an extension in C++11. 'void' becomes a literal type to support constexpr functions which return 'void'. llvm-svn: 180022
* The 'constexpr implies const' rule for non-static member functions is gone inRichard Smith2013-04-211-5/+5
| | | | | | | | | 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
* Skip transparent contexts when looking for using directives in name lookup.Douglas Gregor2013-04-091-4/+8
| | | | | | Fixes the bootstrap regression I introduced in r179067. llvm-svn: 179079
* <rdar://problem/13540899> Collect using directives from all of the semantic ↵Douglas Gregor2013-04-081-0/+19
| | | | | | | | | | | | contexts not represented by scopes. This fixes a regression I introduced in r178136, where we would not consider the using directives from the semantic declaration contexts that aren't represented by the lexical scopes (Scope) when performing unqualified name lookup. This lead to horribly funny diagnostics like "no identifier named 'foo'; did you mean 'foo'?". llvm-svn: 179067
* Only merge down a variable type if the previous declaration wasJohn McCall2013-04-011-0/+43
| | | | | | | | | visible. There's a lot of potential badness in how we're modelling these things, but getting this much correct is reasonably easy. rdar://13535367 llvm-svn: 178488
* <rdar://problem/13317030> Consider using directives when performing ↵Douglas Gregor2013-03-271-0/+30
| | | | | | unqualified name lookup into declarations contexts represented by the qualified-id but not in the actual scope hierarchy. llvm-svn: 178136
* Remove FIXMEs: these are covered by a core issue which we don't yet implementRichard Smith2013-03-261-2/+0
| | | | | | (but we happen to get this part right). llvm-svn: 177958
* Implement special-case name lookup for inheriting constructors: memberRichard Smith2013-03-261-1/+93
| | | | | | | using-declarations with names which look constructor-like are interpreted as constructor names. llvm-svn: 177957
* Add quotation marks to template names in diagnostics.David Blaikie2013-03-051-1/+1
| | | | llvm-svn: 176474
* PR15100: look through type sugar when determining whether we have one of theRichard Smith2013-01-291-0/+23
| | | | | | forms of 'main' which we accept as an extension. llvm-svn: 173758
* Fold tests for C++ 'main' into a single file.Richard Smith2013-01-2910-54/+78
| | | | llvm-svn: 173756
* Properly compute triviality for explicitly-defaulted or deleted special members.Richard Smith2012-12-081-1/+1
| | | | | | | | | | | | | | Remove pre-standard restriction on explicitly-defaulted copy constructors with 'incorrect' parameter types, and instead just make those special members non-trivial as the standard requires. This required making CXXRecordDecl correctly handle classes which have both a trivial and a non-trivial special member of the same kind. This also fixes PR13217 by reimplementing DiagnoseNontrivial in terms of the new triviality computation technology. llvm-svn: 169667
* Fix more try scoping bugs introduced by r167650.David Blaikie2012-11-121-0/+23
| | | | | | | Introduces more clear scoping flags & flag combinations which should hopefully be more understandable. llvm-svn: 167766
* Handle redeclarations of catch variables in catch blocks.David Blaikie2012-11-101-0/+12
| | | | | | Fix to regression caused by r167650, caught by Richard Smith in code review. llvm-svn: 167653
* PR14296: function parameter name collisions in function try/catchDavid Blaikie2012-11-101-0/+25
| | | | | | | | | | | | C++11 3.3.3/2 "A parameter name shall not be redeclared in the outermost block of the function definition nor in the outermost block of any handler associated with a function-try-block." It's not totally clear to me whether the "FIXME" case is covered by this, but Richard Smith thinks it probably should be. It's just a bit more involved to fix that case. llvm-svn: 167650
* Prior to adding the new "expected-no-diagnostics" directive to ↵Andy Gibbs2012-10-1917-0/+17
| | | | | | VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. llvm-svn: 166280
* Instantiate class template specializations during ADL.John McCall2012-08-241-0/+24
| | | | llvm-svn: 162586
* We don't need a lengthy quote from the wrong standard.Douglas Gregor2012-05-011-20/+0
| | | | llvm-svn: 155942
* Add test cases for r155935.Douglas Gregor2012-05-012-0/+110
| | | | llvm-svn: 155940
* If a type is non-literal by virtue of being incomplete produce notesRichard Smith2012-04-251-3/+3
| | | | | | explaining that. llvm-svn: 155598
* When determining whether an identifier followed by a '<' in a memberDouglas Gregor2012-03-101-0/+25
| | | | | | | | access expression is the start of a template-id, ignore function templates found in the context of the entire postfix-expression. Fixes PR11856. llvm-svn: 152520
* Make RequireLiteralType work correctly with incomplete array types. PR12037.Eli Friedman2012-02-201-0/+17
| | | | llvm-svn: 151005
* Update constexpr implementation to match CWG's chosen approach for core issuesRichard Smith2012-02-131-21/+27
| | | | | | | | | | | | | | | | | | | | 1358, 1360, 1452 and 1453. - Instantiations of constexpr functions are always constexpr. This removes the need for separate declaration/definition checking, which is now gone. - This makes it possible for a constexpr function to be virtual, if they are only dependently virtual. Virtual calls to such functions are not constant expressions. - Likewise, it's now possible for a literal type to have virtual base classes. A constexpr constructor for such a type cannot actually produce a constant expression, though, so add a special-case diagnostic for a constructor call to such a type rather than trying to evaluate it. - Classes with trivial default constructors (for which value initialization can produce a fully-initialized value) are considered literal types. - Classes with volatile members are not literal types. - constexpr constructors can be members of non-literal types. We do not yet use static initialization for global objects constructed in this way. llvm-svn: 150359
* CWG issue 1405: mutable members are allowed in literal types, but can't undergoRichard Smith2012-02-091-18/+0
| | | | | | lvalue-to-rvalue conversions in constant expressions. llvm-svn: 150145
OpenPOWER on IntegriCloud