summaryrefslogtreecommitdiffstats
path: root/test/CXX
Commit message (Collapse)AuthorAgeFilesLines
* Bah...Bill Wendling2012-05-121-17/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_31@156702 91177308-0d34-0410-b5e6-96231b3b80d8
* Merging r155426:Bill Wendling2012-05-121-1/+9
| | | | | | | | | | | | | ------------------------------------------------------------------------ r155426 | rsmith | 2012-04-23 22:48:42 -0700 (Mon, 23 Apr 2012) | 3 lines Don't try to delay parsing the exception specification for a data member of a class; we would never actually parse it and attach it to the type. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_31@156701 91177308-0d34-0410-b5e6-96231b3b80d8
* Merging r155218:Bill Wendling2012-05-122-4/+52
| | | | | | | | | | | | | | | ------------------------------------------------------------------------ r155218 | rsmith | 2012-04-20 11:46:14 -0700 (Fri, 20 Apr 2012) | 5 lines Fix bug where a class's (deleted) copy constructor would be implicitly given a non-const reference parameter type if the class had any subobjects with deleted copy constructors. This causes a rejects-valid if the class's copy constructor is explicitly defaulted (as happens for some implementations of std::pair etc). ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_31@156682 91177308-0d34-0410-b5e6-96231b3b80d8
* Merging r155424:Bill Wendling2012-05-121-1/+10
| | | | | | | | | | | | | ------------------------------------------------------------------------ r155424 | rsmith | 2012-04-23 22:06:35 -0700 (Mon, 23 Apr 2012) | 3 lines PR12629: Cope with parenthesized function types when attaching a delayed exception specification to a function. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_31@156679 91177308-0d34-0410-b5e6-96231b3b80d8
* Merging r155975:Bill Wendling2012-05-121-2/+3
| | | | | | | | | | | | | | ------------------------------------------------------------------------ r155975 | rsmith | 2012-05-01 18:29:43 -0700 (Tue, 01 May 2012) | 4 lines Disable our non-standard delayed parsing of exception specifications. Delaying the parsing of such things appears to be a conforming extension, but it breaks libstdc++4.7's std::pair. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_31@156672 91177308-0d34-0410-b5e6-96231b3b80d8
* Merging r155728:Bill Wendling2012-04-273-20/+20
| | | | | | | | | | | | | | ------------------------------------------------------------------------ r155728 | rsmith | 2012-04-27 12:33:05 -0700 (Fri, 27 Apr 2012) | 4 lines PR12224 (sort of): Diagnose inheriting constructor declarations in C++11 mode. We do not support IRGen for these, and get some parts of the semantic analysis wrong. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_31@155731 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement DR1330 in C++11 mode, to support libstdc++4.7 which uses it.Richard Smith2012-04-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have a new flavor of exception specification, EST_Uninstantiated. A function type with this exception specification carries a pointer to a FunctionDecl, and the exception specification for that FunctionDecl is instantiated (if needed) and used in the place of the function type's exception specification. When a function template declaration with a non-trivial exception specification is instantiated, the specialization's exception specification is set to this new 'uninstantiated' kind rather than being instantiated immediately. Expr::CanThrow has migrated onto Sema, so it can instantiate exception specs on-demand. Also, any odr-use of a function triggers the instantiation of its exception specification (the exception specification could be needed by IRGen). In passing, fix two places where a DeclRefExpr was created but the corresponding function was not actually marked odr-used. We used to get away with this, but don't any more. Also fix a bug where instantiating an exception specification which refers to function parameters resulted in a crash. We still have the same bug in default arguments, which I'll be looking into next. This, plus a tiny patch to fix libstdc++'s common_type, is enough for clang to parse (and, in very limited testing, support) all of libstdc++4.7's standard headers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154886 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement the last part of C++ [class.mem]p2, delaying the parsing ofDouglas Gregor2012-04-163-1/+38
| | | | | | | | | | exception specifications on member functions until after the closing '}' for the containing class. This allows, for example, a member function to throw an instance of its own class. Fixes PR12564 and a fairly embarassing oversight in our C++98/03 support. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154844 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement C++11 [expr.prim.general]p3, which permits the use of 'this'Douglas Gregor2012-04-161-0/+90
| | | | | | | | | | | | | | | | | | | | | | | | | in the declaration of a non-static member function after the (optional) cv-qualifier-seq, which in practice means in the exception specification and late-specified return type. The new scheme here used to manage 'this' outside of a member function scope is more general than the Scope-based mechanism previously used for non-static data member initializers and late-parsesd attributes, because it can also handle the cv-qualifiers on the member function. Note, however, that a separate pass is required for static member functions to determine whether 'this' was used, because we might not know that we have a static function until after declaration matching. Finally, this introduces name mangling for 'this' and for the implicit 'this', which is intended to match GCC's mangling. Independent verification for the new mangling test case would be appreciated. Fixes PR10036 and PR12450. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154799 91177308-0d34-0410-b5e6-96231b3b80d8
* 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! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154656 91177308-0d34-0410-b5e6-96231b3b80d8
* Improve diagnostics in C++11 when a non-type template argument for aDouglas Gregor2012-04-101-2/+3
| | | | | | | non-type template parameter of pointer type is not a constant expression. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154424 91177308-0d34-0410-b5e6-96231b3b80d8
* Rework implementation of null non-type template arguments based onDouglas Gregor2012-04-101-2/+6
| | | | | | | | | Richard's feedback, to properly catch non-constant expressions and type mismatches. Finishes <rdar://problem/11193097>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154407 91177308-0d34-0410-b5e6-96231b3b80d8
* Disambiguation of '[[':Richard Smith2012-04-101-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * In C++11, '[[' is ill-formed unless it starts an attribute-specifier. Reject array sizes and array indexes which begin with a lambda-expression. Recover by parsing the lambda as a lambda. * In Objective-C++11, either '[' could be the start of a message-send. Fully disambiguate this case: it turns out that the grammars of message-sends, lambdas and attributes do not actually overlap. Accept any occurrence of '[[' where either '[' starts a message send, but reject a lambda in an array index just like in C++11 mode. Implement a couple of changes to the attribute wording which occurred after our attributes implementation landed: * In a function-declaration, the attributes go after the exception specification, not after the right paren. * A reference type can have attributes applied. * An 'identifier' in an attribute can also be a keyword. Support for alternative tokens (iso646 keywords) in attributes to follow. And some bug fixes: * Parse attributes after declarator-ids, even if they are not simple identifiers. * Do not accept attributes after a parenthesized declarator. * Accept attributes after an array size in a new-type-id. * Partially disamiguate 'delete' followed by a lambda. More work is required here for the case where the lambda-introducer is '[]'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154369 91177308-0d34-0410-b5e6-96231b3b80d8
* My original patch missed the virtual-base case for destroyingJohn McCall2012-04-091-0/+16
| | | | | | | | | | | | base-class subojects. Incidentally, thinking about virtual bases makes it clear to me that we're not appropriately computing the access to the virtual base's member because we're not computing the best possible access to the virtual base at all; in fact, we're basically assuming it's public. I'll file a separate PR about that. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154346 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the access check performed as part of the determination of whetherJohn McCall2012-04-091-0/+20
| | | | | | | | to define a special member function as deleted so that it properly establishes an object context for the accesses to the base subobject members. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154343 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix several problems with protected access control:John McCall2012-04-072-10/+78
| | | | | | | | | | | | | | | | | | | | | - The [class.protected] restriction is non-trivial for any instance member, even if the access lacks an object (for example, if it's a pointer-to-member constant). In this case, it is equivalent to requiring the naming class to equal the context class. - The [class.protected] restriction applies to accesses to constructors and destructors. A protected constructor or destructor can only be used to create or destroy a base subobject, as a direct result. - Several places were dropping or misapplying object information. The standard could really be much clearer about what the object type is supposed to be in some of these accesses. Usually it's easy enough to find a reasonable answer, but still, the standard makes a very confident statement about accesses to instance members only being possible in either pointer-to-member literals or member access expressions, which just completely ignores concepts like constructor and destructor calls, using declarations, unevaluated field references, etc. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154248 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement support for null non-type template arguments for non-typeDouglas Gregor2012-04-061-0/+55
| | | | | | | | template parameters of pointer, pointer-to-member, or nullptr_t type in C++11. Fixes PR9700 / <rdar://problem/11193097>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154219 91177308-0d34-0410-b5e6-96231b3b80d8
* Temporary workaround for bug#12457: turn the 'constexpr function never producesRichard Smith2012-04-051-0/+1
| | | | | | | | | a constant expression' error into a DefaultError ExtWarn, so that it can be disabled and is suppressed in system headers. libstdc++4.7 contains some such functions which we currently can't evaluate as constant expressions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154115 91177308-0d34-0410-b5e6-96231b3b80d8
* Improve diagnostics for invalid use of non-static members / this:Richard Smith2012-04-056-10/+10
| | | | | | | | | | | | | * s/nonstatic/non-static/ in the diagnostics, since the latter form outvoted the former by 28-2 in our diagnostics. * Fix the "use of member in static member function" diagnostic to correctly detect this situation inside a block or lambda. * Produce a more specific "invalid use of non-static member" diagnostic for the case where a nested class member refers to a member of a lexically-surrounding class. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154073 91177308-0d34-0410-b5e6-96231b3b80d8
* 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;"). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154068 91177308-0d34-0410-b5e6-96231b3b80d8
* Hardcode a triple to prevent the test failing on targets which don't support ↵Richard Smith2012-04-041-1/+1
| | | | | | __thread. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154058 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement C++11 [temp.arg.nontype]'s permission to use the address of an objectRichard Smith2012-04-041-13/+51
| | | | | | | or function with internal linkage as a non-type template argument. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154053 91177308-0d34-0410-b5e6-96231b3b80d8
* Dependent-sequence initialization of a single element can be directDouglas Gregor2012-04-041-1/+13
| | | | | | | list-initialization. Loosen an over-eager assertion to fix PR12453. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153995 91177308-0d34-0410-b5e6-96231b3b80d8
* When computing the conversion sequence in overload resolutionJohn McCall2012-04-041-0/+15
| | | | | | | | for converting an empty list to a scalar, be sure to initialize the source and destination types so that comparison of conversion sequences will work in case there are multiple viable candidates. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153993 91177308-0d34-0410-b5e6-96231b3b80d8
* PR10217 diagnostic fix: don't say 'copy constructor' when we meanRichard Smith2012-04-021-1/+1
| | | | | | | 'copy assignment operator'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153897 91177308-0d34-0410-b5e6-96231b3b80d8
* Finish PR10217: Ensure we say that a special member was implicitly, notRichard Smith2012-04-023-12/+10
| | | | | | | explicitly, deleted in all relevant cases, and explain why. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153894 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement DR1402: if a field or base class is not movable, the derived class'sRichard Smith2012-04-022-1/+100
| | | | | | | | | | | | move constructor/move assignment operator are not declared, rather than being defined as deleted, so move operations on the derived class fall back to copying rather than moving. If a move operation on the derived class is explicitly defaulted, the unmovable subobject will be copied instead of being moved. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153883 91177308-0d34-0410-b5e6-96231b3b80d8
* Basic semantic analysis support for inheriting constructor declarations inRichard Smith2012-04-023-1/+56
| | | | | | | dependent contexts. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153858 91177308-0d34-0410-b5e6-96231b3b80d8
* PR10217: Provide diagnostics explaining why an implicitly-deleted specialRichard Smith2012-03-306-77/+87
| | | | | | | member function is deleted. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153773 91177308-0d34-0410-b5e6-96231b3b80d8
* Extend -Wc++11-narrowing to cover converted constant expressions as well as ↵Eli Friedman2012-03-291-0/+8
| | | | | | braced-initializers. <rdar://problem/11121178>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153703 91177308-0d34-0410-b5e6-96231b3b80d8
* Unify and fix our checking of C++ [dcl.meaning]p1's requirementsDouglas Gregor2012-03-282-3/+16
| | | | | | | | | | concerning qualified declarator-ids. We now diagnose extraneous qualification at namespace scope (which we had previously missed) and diagnose these qualification errors for all kinds of declarations; it was rather uneven before. Fixes <rdar://problem/11135644>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153577 91177308-0d34-0410-b5e6-96231b3b80d8
* Support for definitions of member enumerations of class templates outside theRichard Smith2012-03-232-0/+161
| | | | | | | | class template's definition, and for explicit specializations of such enum members. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153304 91177308-0d34-0410-b5e6-96231b3b80d8
* Diagnose tag and class template declarations with qualifiedDouglas Gregor2012-03-172-1/+23
| | | | | | | declarator-ids that occur at class scope. Fixes PR8019. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153002 91177308-0d34-0410-b5e6-96231b3b80d8
* Unpluralize -Wfoo-conversions warnings for consistency.David Blaikie2012-03-151-1/+1
| | | | | | | | | | | | Err on the side of brevity and rename (while providing aliases for the original name) -Wbool-conversions, -Wint-conversions, and -Wvector-conversions for consistency with constant, literal, string, and sign conversion warnings. And name the diagnostic groups explicitly while I'm here rather than rewriting the string in the groups and sema td files. Curiously, vector-conversion is not under -Wconversion. Perhaps it should be. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152776 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152750 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement [temp.param]p5: the top-level cv-qualifiers on a non-type templateRichard Smith2012-03-131-0/+13
| | | | | | | parameter's declaration are ignored when determining the parameter's type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152619 91177308-0d34-0410-b5e6-96231b3b80d8
* PR11850 + duplicates: don't assume that a function parameter pack expansion isRichard Smith2012-03-131-0/+46
| | | | | | | at the end of the parameter list. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152618 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR10447: lazily building name lookup tables for DeclContexts was broken.Richard Smith2012-03-131-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | The deferred lookup table building step couldn't accurately tell which Decls should be included in the lookup table, and consequently built different tables in some cases. Fix this by removing lazy building of DeclContext name lookup tables. In practice, the laziness was frequently not worthwhile in C++, because we performed lookup into most DeclContexts. In C, it had a bit more value, since there is no qualified lookup. In the place of lazy lookup table building, we simply don't build lookup tables for function DeclContexts at all. Such name lookup tables are not useful, since they don't capture the scoping information required to correctly perform name lookup in a function scope. The resulting performance delta is within the noise on my testing, but appears to be a very slight win for C++ and a very slight loss for C. The C performance can probably be recovered (if it is a measurable problem) by avoiding building the lookup table for the translation unit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152608 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152575 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix parsing of trailing-return-type. Types are syntactically prohibited fromRichard Smith2012-03-123-3/+3
| | | | | | | | | being defined here: [] () -> struct S {} does not define struct S. In passing, implement DR1318 (syntactic disambiguation of 'final'). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152551 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix parsing of type-specifier-seq's. Types are syntactically allowed to beRichard Smith2012-03-123-12/+16
| | | | | | | | | | | | | | | | | | | defined here, but not semantically, so new struct S {}; is always ill-formed, even if there is a struct S in scope. We also had a couple of bugs in ParseOptionalTypeSpecifier caused by it being under-loved (due to it only being used in a few places) so merge it into ParseDeclarationSpecifiers with a new DeclSpecContext. To avoid regressing, this required improving ParseDeclarationSpecifiers' diagnostics in some cases. This also required teaching ParseSpecifierQualifierList about constexpr... which incidentally fixes an issue where we'd allow the constexpr specifier in other bad places. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152549 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152529 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152520 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix crash & accepts-invalid for array of arrays of user defined type.David Blaikie2012-03-102-0/+30
| | | | | | | Test case/other help by Richard Smith. Code review by John McCall. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152519 91177308-0d34-0410-b5e6-96231b3b80d8
* PR12225: The requirement that literal operators be namespace-scope functionsRichard Smith2012-03-101-0/+2
| | | | | | | does not imply that such functions can't be declared at block scope. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152509 91177308-0d34-0410-b5e6-96231b3b80d8
* Improve diagnostics for UCNs referring to control characters and members of theRichard Smith2012-03-092-0/+97
| | | | | | | | | | | basic source character set in C++98. Add -Wc++98-compat diagnostics for same in literals in C++11. Extend such support to cover string literals as well as character literals, and mark N2170 as done. This seems too minor to warrant a release note to me. Let me know if you disagree. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152444 91177308-0d34-0410-b5e6-96231b3b80d8
* Harden test for 32 bit platforms, where size_t is unsigned int (not unsigned ↵Benjamin Kramer2012-03-091-5/+5
| | | | | | long). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152404 91177308-0d34-0410-b5e6-96231b3b80d8
* Literal operator suffixes and regular names live in separate namespaces.Richard Smith2012-03-091-0/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152395 91177308-0d34-0410-b5e6-96231b3b80d8
* Literal operators can't have default arguments.Richard Smith2012-03-091-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152394 91177308-0d34-0410-b5e6-96231b3b80d8
* Support for raw and template forms of numeric user-defined literals,Richard Smith2012-03-096-0/+106
| | | | | | | and lots of tidying up. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152392 91177308-0d34-0410-b5e6-96231b3b80d8