summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/class/class.friend/p1.cpp
Commit message (Collapse)AuthorAgeFilesLines
* DR674, PR38883, PR40238: Qualified friend lookup should look for aRichard Smith2019-01-071-2/+2
| | | | | | | | | | | | | | | | | | template specialization if there is no matching non-template function. This exposed a couple of related bugs: - we would sometimes substitute into a friend template instead of a suitable non-friend declaration; this would now crash because we'd decide the specialization of the friend is a redeclaration of itself - ADL failed to properly handle the case where an invisible local extern declaration redeclares an invisible friend Both are fixed herein: in particular, we now never make invisible friends or local extern declarations visible to name lookup unless they are the only declaration of the entity. (We already mostly did this for local extern declarations.) llvm-svn: 350505
* Lit C++11 Compatibility Patch #8Charles Li2016-04-141-1/+6
| | | | | | 24 tests have been updated for C++11 compatibility. llvm-svn: 266387
* [Sema] Don't crash when friending an unqualified templated constructorDavid Majnemer2015-09-301-0/+6
| | | | | | | | | | Unqualified templated constructors cannot be friended and our lack of a diagnostic led to violated invariants. Instead, raise a diagnostic when processing the friend declaration. This fixes PR20251. llvm-svn: 248953
* Don't crash if a declarator in a friend decl doesn't have a name.Nico Weber2015-01-161-0/+4
| | | | | | | | | | | There was already an explicit check for that for the first decl. Move that to a different place so that it's called for the following decls too. Also don't randomly set the BitfieldSize ExprResult to true (this sets a pointer to true internally). Found by SLi's bot. llvm-svn: 226306
* PR11684, core issue 1417:Richard Smith2012-02-101-1/+1
| | | | | | | | | | | | | | o Correct the handling of the restrictions on usage of cv-qualified and ref-qualified function types. o Fix a bug where such types were rejected in template type parameter default arguments, due to such arguments not being treated as a template type arg context. o Remove the ExtWarn for usage of such types as template arguments; that was a standard defect, not a GCC extension. o Improve the wording and unify the code for diagnosing cv-qualifiers with the code for diagnosing ref-qualifiers. llvm-svn: 150244
* Modify how the -verify flag works. Currently, the verification string andRichard Trieu2011-12-151-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | diagnostic message are compared. If either is a substring of the other, then no error is given. This gives rise to an unexpected case: // expect-error{{candidate function has different number of parameters}} will match the following error messages from Clang: candidate function has different number of parameters (expected 1 but has 2) candidate function has different number of parameters It will also match these other error messages: candidate function function has different number of parameters number of parameters This patch will change so that the verification string must be a substring of the diagnostic message before accepting. Also, all the failing tests from this change have been corrected. Some stats from this cleanup: 87 - removed extra spaces around verification strings 70 - wording updates to diagnostics 40 - extra leading or trailing characters (typos, unmatched parens or quotes) 35 - diagnostic level was included (error:, warning:, or note:) 18 - flag name put in the warning (-Wprotocol) llvm-svn: 146619
* Make sure that we diagnose invalid qualifiers on friend functions.Douglas Gregor2010-10-141-1/+2
| | | | llvm-svn: 116527
* When pretty-printing tag types, only print the tag if we're in C (andJohn McCall2010-03-101-1/+1
| | | | | | | | | | therefore not creating ElaboratedTypes, which are still pretty-printed with the written tag). Most of these testcase changes were done by script, so don't feel too sorry for my fingers. llvm-svn: 98149
* Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar2009-12-151-1/+1
| | | | | | | | | - 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
* Improve diagnostics when the parser encounters a declarator with anDouglas Gregor2009-10-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | unknown type name, e.g., foo::bar x; when "bar" does not refer to a type in "foo". With this change, the parser now calls into the action to perform diagnostics and can try to recover by substituting in an appropriate type. For example, this allows us to easily diagnose some missing "typename" specifiers, which we now do: test/SemaCXX/unknown-type-name.cpp:29:1: error: missing 'typename' prior to dependent type name 'A<T>::type' A<T>::type A<T>::f() { return type(); } ^~~~~~~~~~ typename Fixes PR3990. llvm-svn: 84053
* When adding a friend class declaration to the lookup tables, use the access ↵John McCall2009-09-021-0/+4
| | | | | | | | | | specifier of any previous declaration in case we replace it in a class's declaration table. Fixes bug 4858. This sort of thing makes me reconsider putting friend declarations in declaration lists. llvm-svn: 80750
* Ensure that the tag decls of friend decls aren't added to the friending class'sJohn McCall2009-09-021-2/+0
| | | | | | | decl list, and remove some workarounds that were due to this. Thanks to Eli for pointing this out and providing the test case. llvm-svn: 80745
* Omnibus friend decl refactoring. Instead of cloning AST classes for friendJohn McCall2009-08-281-0/+7
| | | | | | | | | | | | | | declarations of same, introduce a single AST class and add appropriate bits (encoded in the namespace) for whether a decl is "real" or not. Much hackery about previously-declared / not-previously-declared, but it's essentially mandated by the standard that friends alter lookup, and this is at least fairly non-intrusive. Refactor the Sema methods specific to friends for cleaner flow and less nesting. Incidentally solve a few bugs, but I remain confident that we can put them back. llvm-svn: 80353
* Modify an assert to capture the restriction on friend declarations moreJohn McCall2009-08-251-0/+8
| | | | | | | accurately. Prevents the assert from triggering incorrectly when friending functions first declared in extern "C" contexts. Fixes bug 4757. llvm-svn: 80016
* Permit a class to friend its members in C++0x, without restriction.John McCall2009-08-061-2/+2
| | | | | | | Permit a class to friend its class members in C++ 98, as long as extensions are enabled (and even when they aren't, only give an extwarn about it). llvm-svn: 78332
* First pass at friend semantics.John McCall2009-08-061-0/+59
llvm-svn: 78274
OpenPOWER on IntegriCloud