summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/class/class.friend
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-142-3/+16
| | | | | | 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
* C++11: don't warn about the deprecated 'register' keyword if it's combined withRichard Smith2013-06-171-1/+1
| | | | | | an asm label. llvm-svn: 184069
* Add -Wdeprecated warnings and fixits for things deprecated in C++11:Richard Smith2013-06-131-0/+4
| | | | | | | | | - 'register' storage class - dynamic exception specifications Only the former check is enabled by default for now (the latter might be quite noisy). llvm-svn: 183881
* Parsing support for thread_local and _Thread_local. We give them the sameRichard Smith2013-04-121-2/+10
| | | | | | semantics as __thread for now. llvm-svn: 179424
* Prior to adding the new "expected-no-diagnostics" directive to ↵Andy Gibbs2012-10-192-0/+2
| | | | | | VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. llvm-svn: 166280
* 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 the -Wc++11-compat warnings ignored by default, so we don't breakDouglas Gregor2011-10-251-1/+1
| | | | | | | valid C++98/03 code. However, add these warnings to -Wall, for those who obviously already like clean code. llvm-svn: 142903
* In C++11, a class's members are allowed to be nominated as friends.Richard Smith2011-10-181-0/+12
| | | | llvm-svn: 142393
* Switch diagnostic text from "C++0x" over to "C++11".Douglas Gregor2011-10-122-2/+2
| | | | | | | | We'd also like for "C++11" or "c++11" to be used for the warning groups, but without removing the old warning flags. Patches welcome; I've run out of time to work on this today. llvm-svn: 141801
* PR10458: Finesse behaviour of C++0x features when in pre-0x mode. Accept ↵Richard Smith2011-09-041-1/+1
| | | | | | for-range and auto with an ExtWarn, and produce a -Wc++0x-compat warning in C++98 mode when auto is used as a storage class. llvm-svn: 139102
* Tweak the diagnostics for the C++0x extensions to friend types to noteDouglas Gregor2011-05-101-2/+2
| | | | | | | | that they are C++0x extensions, and put them in the appropriate group. We already support most of the semantics. Addresses <rdar://problem/9407525>. llvm-svn: 131153
* Make sure that we diagnose invalid qualifiers on friend functions.Douglas Gregor2010-10-141-1/+2
| | | | llvm-svn: 116527
* Improve handling of friend types in several ways:Douglas Gregor2010-04-071-2/+2
| | | | | | | | | | | - When instantiating a friend type template, perform semantic analysis on the resulting type. - Downgrade the errors concerning friend type declarations that do not refer to classes to ExtWarns in C++98/03. C++0x allows practically any type to be befriended, and ignores the friend declaration if the type is not a class. llvm-svn: 100635
* 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-154-4/+4
| | | | | | | | | - 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
* Rework the Parse-Sema interaction for friends to better support friendDouglas Gregor2009-09-261-1/+3
| | | | | | | | | class templates. We now treat friend class templates much more like normal class templates, except that they still get special name lookup rules. Fixes PR5057 and eliminates a bunch of spurious diagnostics in <iostream>. llvm-svn: 82848
* 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
* Fix bug 4784 and allow friend declarations to properly extendJohn McCall2009-08-311-0/+37
| | | | | | existing declaration chains. llvm-svn: 80636
* 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-063-0/+77
llvm-svn: 78274
OpenPOWER on IntegriCloud