summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/nested-name-spec.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Give nicer note when a member redeclaration has or lacks 'const'Kaelyn Uhrain2011-10-101-3/+3
| | | | llvm-svn: 141555
* Match type names and give more info for out-of-line function definition errors.Kaelyn Uhrain2011-08-041-2/+2
| | | | | | | | | | | | | | Having a function declaration and definition with different types for a parameter where the types have same (textual) name can occur when an unqualified type name resolves to types in different namespaces in each location. The error messages have been extended by adding notes that point to the first parameter of the function definition that doesn't match the declaration, instead of a generic "member declaration nearly matches". The generic message is still used in cases where the mismatch is not in the paramenter list, such as mismatched cv qualifiers on the member function itself. llvm-svn: 136891
* Update test for r133934.John McCall2011-06-271-1/+1
| | | | llvm-svn: 133942
* Only do delayed diagnostics if there were no errors when parsing the decl.Argyrios Kyrtzidis2011-06-241-0/+19
| | | | | | Fixes crash in http://llvm.org/PR10109 & rdar://9584039. llvm-svn: 133816
* Test case for previous commitDouglas Gregor2011-02-241-0/+3
| | | | llvm-svn: 126360
* When the out-of-line definition differs from the declaration in the return type,Argyrios Kyrtzidis2011-02-051-0/+5
| | | | | | | | | say "out-of-line definition differ from the declaration in the return type" instead of the silly "functions that differ only in their return type cannot be overloaded". Addresses rdar://7980179. llvm-svn: 124939
* Generalize the checking for qualification of (non-friend) classDouglas Gregor2010-10-131-0/+10
| | | | | | | | members. Provide a hard error when the qualification doesn't match the current class type, or a warning + Fix-it if it does match the current class type. Fixes PR8159. llvm-svn: 116445
* Better diagnostic for superfluous scope specifier inside a class definition ↵Francois Pichet2010-10-011-0/+4
| | | | | | | | | | | for member functions. + Fixit. Example: class A { void A::foo(); //warning: extra qualification on member 'foo' }; llvm-svn: 115347
* Make this grossness default to the error it should always be.Chandler Carruth2010-07-161-1/+1
| | | | llvm-svn: 108511
* Butcher a perfectly reasonable diagnostic to pacify old versions of SWIG.Chandler Carruth2010-07-161-1/+1
| | | | llvm-svn: 108505
* Make sure to search semantic scopes and appropriate template-parameterDouglas Gregor2010-05-141-0/+16
| | | | | | | scopes during unqualified name lookup that has fallen out to namespace scope. Fixes PR7133. llvm-svn: 103766
* Turn access control on by default in -cc1.John McCall2010-04-091-1/+1
| | | | | | | | Remove -faccess-control from -cc1; add -fno-access-control. Make the driver pass -fno-access-control by default. Update a bunch of tests to be correct under access control. llvm-svn: 100880
* Make CXXScopeSpec invalid when incomplete, and propagate that into anyJeffrey Yasskin2010-04-081-5/+3
| | | | | | | Declarator that depends on it. This fixes several redundant errors and bad recoveries. llvm-svn: 100779
* Fix some redundant errors by changing CXXScopeSpec::isSet calls intoJeffrey Yasskin2010-04-071-3/+3
| | | | | | isNotEmpty calls. llvm-svn: 100722
* Improve diagnostics when an elaborated-type-specifer containing aDouglas Gregor2010-03-311-1/+1
| | | | | | | | | | | | | | | | nested-name-specifier (e.g., "class T::foo") fails to find a tag member in the scope nominated by the nested-name-specifier. Previously, we gave a bland error: 'Nested' does not name a tag member in the specified scope which didn't actually say where we were looking, which was rather horrible when the nested-name-specifier was instantiated. Now, we give something a bit better: error: no class named 'Nested' in 'NoDepBase<T>' llvm-svn: 100060
* When pretty-printing tag types, only print the tag if we're in C (andJohn McCall2010-03-101-7/+7
| | | | | | | | | | 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
* Fix an assertion-on-error during tentative constructor parsing byJohn McCall2010-02-261-2/+3
| | | | | | | | | | propagating error conditions out of the various annotate-me-a-snowflake routines. Generally (but not universally) removes redundant diagnostics as well as, you know, not crashing on bad code. On the other hand, I have just signed myself up to fix fiddly parser errors for the next week. Again. llvm-svn: 97221
* Fix the crash-on-invalid from PR6259.John McCall2010-02-081-0/+9
| | | | llvm-svn: 95554
* Fix two redefinitions in test cases that weren't diagnosed yet, but will be ↵Sebastian Redl2010-01-261-1/+1
| | | | | | soon. llvm-svn: 94565
* Improve the reporting of non-viable overload candidates by noting the reasonJohn McCall2010-01-131-1/+1
| | | | | | | | why the candidate is non-viable. There's a lot we can do to improve this, but it's a good start. Further improvements should probably be integrated with the bad-initialization reporting routines. llvm-svn: 93277
* Improve the diagnostics used to report implicitly-generated class membersJohn McCall2010-01-061-1/+1
| | | | | | | | | as parts of overload sets. Also, refer to constructors as 'constructors' rather than functions. Adjust a lot of tests. llvm-svn: 92832
* Just push a new scope when parsing an out-of-line variable definition.John McCall2009-12-191-0/+13
| | | | | | | Magically fixes all the terrible lookup problems associated with not pushing a new scope. Resolves an ancient xfail and an LLVM misparse. llvm-svn: 91769
* Switch more of Sema::CheckInitializerTypes over toDouglas Gregor2009-12-191-2/+2
| | | | | | | | | | InitializationSequence. Specially, switch initialization of a C++ class type (either copy- or direct-initialization). Also, make sure that we create an elidable copy-construction when performing copy initialization of a C++ class variable. Fixes PR5826. llvm-svn: 91750
* Pull Sema::isAcceptableLookupResult into SemaLookup. Extract the criteria intoJohn McCall2009-12-181-2/+15
| | | | | | | | | | | | | | | different functions and pick the function at lookup initialization time. In theory we could actually divide the criteria functions into N different functions for the N cases, but it's so not worth it. Among other things, lets us invoke LookupQualifiedName without recomputing IDNS info every time. Do some refactoring in SemaDecl to avoid an awkward special case in LQN that was only necessary for redeclaration testing for anonymous structs/unions --- which could be done more efficiently with a scoped lookup anyway. llvm-svn: 91676
* 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
* reapply my patch for PR4451, which improves diagnostics for :: vs : confusion.Chris Lattner2009-12-071-5/+3
| | | | | | This time with a fix to bail out when in a dependent context. llvm-svn: 90730
* revert my previous patch, it is breaking something and I don't have timeChris Lattner2009-12-061-3/+5
| | | | | | to fix it ATM. llvm-svn: 90717
* this is really about both PR's, 4452 is "don't crash", 4451 is "recover nicely".Chris Lattner2009-12-061-1/+1
| | | | llvm-svn: 90714
* implement PR4451, improving error recovery for a mistaken : where a :: wasChris Lattner2009-12-061-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | intended. On the first testcase in the bug, we now produce: cxx-decl.cpp:12:2: error: unexpected ':' in nested name specifier y:a a2; ^ :: instead of: t.cc:8:1: error: C++ requires a type specifier for all declarations x:a a2; ^ t.cc:8:2: error: invalid token after top level declarator x:a a2; ^ ; t.cc:9:11: error: use of undeclared identifier 'a2' x::a a3 = a2; ^ llvm-svn: 90713
* Remove unnecessary -fms-extensions=0 from tests (this command line syntax is ↵Daniel Dunbar2009-11-291-1/+1
| | | | | | going away). llvm-svn: 90066
* Implement the rules in C++ [basic.link] and C99 6.2.2 for computingDouglas Gregor2009-11-251-1/+0
| | | | | | | | | | | the linkage of a declaration. Switch the lame (and completely wrong) NamedDecl::hasLinkage() over to using the new NamedDecl::getLinkage(), along with the "can this declaration be a template argument?" check that started all of this. Fixes -fsyntax-only for PR5597. llvm-svn: 89891
* Disabling some MS extensions which cause these tests to failJohn Thompson2009-10-271-1/+1
| | | | llvm-svn: 85236
* Improve diagnostics when the parser encounters a declarator with anDouglas Gregor2009-10-131-3/+3
| | | | | | | | | | | | | | | | | | | | | | | 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
* Unify our diagnostic printing for errors of the form, "we didn't likeDouglas Gregor2009-10-131-6/+6
| | | | | | | | | | what we found when we looked into <blah>", where <blah> is a DeclContext*. We can now format DeclContext*'s in nice ways, e.g., "namespace N", "the global namespace", "'class Foo'". This is part of PR3990, but we're not quite there yet. llvm-svn: 84028
* Rewrite of our handling of name lookup in C++ member access expressions, e.g.,Douglas Gregor2009-09-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | x->Base::f We no longer try to "enter" the context of the type that "x" points to. Instead, we drag that object type through the parser and pass it into the Sema routines that need to know how to perform lookup within member access expressions. We now implement most of the crazy name lookup rules in C++ [basic.lookup.classref] for non-templated code, including performing lookup both in the context of the type referred to by the member access and in the scope of the member access itself and then detecting ambiguities when the two lookups collide (p1 and p4; p3 and p7 are still TODO). This change also corrects our handling of name lookup within template arguments of template-ids inside the nested-name-specifier (p6; we used to look into the scope of the object expression for them) and fixes PR4703. I have disabled some tests that involve member access expressions where the object expression has dependent type, because we don't yet have the ability to describe dependent nested-name-specifiers starting with an identifier. llvm-svn: 80843
* Fix a crash that occurs in this C++ case:Argyrios Kyrtzidis2009-07-211-1/+4
| | | | | | | | | struct foo { static bool value; }; bool (foo::value); // crash because of parens llvm-svn: 76538
* Improve error recovery in C++: when we hit 'implicit int' cases in C++,Chris Lattner2009-06-261-2/+1
| | | | | | | | | | these are usually because the parser was thoroughly confused. In addition to typing the value being declared as an int and hoping for the best, we mark the value as invalid so we don't get chains of errors when it is used downstream. In C, implicit int actually is valid, so typing the thing as int is good and marking it invalid is bad. :) llvm-svn: 74266
* fix PR4452, a crash on invalid. The error recovery is still terrible in ↵Chris Lattner2009-06-261-0/+24
| | | | | | | | this case but at least we don't crash :) llvm-svn: 74264
* Make the implicit-int handling error recovery stuff handle C++Chris Lattner2009-04-141-3/+3
| | | | | | | | | | | | | | | | | | | nested name specifiers. Now we emit stuff like: t.cpp:8:13: error: unknown type name 'X' static foo::X P; ~~~~ ^ instead of: t.cpp:8:16: error: invalid token after top level declarator static foo::X P; ^ This is inspired by a really awful error message I got from g++ when I misspelt diag::kind as diag::Kind. llvm-svn: 69086
* Fix some C++ error recovery problems in init declarator parsingChris Lattner2009-04-121-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | that I noticed working on other things. Instead of emitting: t2.cc:1:8: error: use of undeclared identifier 'g' int x(*g); ^ t2.cc:1:10: error: expected ')' int x(*g); ^ t2.cc:1:6: note: to match this '(' int x(*g); ^ We now only emit: t2.cc:1:7: warning: type specifier missing, defaults to 'int' int x(*g); ^ Note that the example in SemaCXX/nested-name-spec.cpp:f4 is still not great, we now produce both of: void f4(undef::C); // expected-error {{use of undeclared identifier 'undef'}} \ expected-error {{variable has incomplete type 'void'}} The second diagnostic should be silenced by something getting marked invalid. I don't plan to fix this though. llvm-svn: 68919
* Add some more code modification hintsDouglas Gregor2009-04-011-2/+2
| | | | llvm-svn: 68261
* Tighten the setAccess assert. We now allow AS_none if the decl contex is not ↵Anders Carlsson2009-03-251-1/+0
| | | | | | | | a C++ record decl. Also, fix fallout from the change. llvm-svn: 67717
* Improve handling of base initializers. We now parse initializers in out of ↵Anders Carlsson2009-03-251-1/+2
| | | | | | | | | | | | | | | | | | | | | | line decls, such as: class C { C() { } int a; }; C::C() : a(10) { } We also diagnose when initializers are used on declarations that aren't constructors: t.cpp:1:10: error: only constructors take base initializers void f() : a(10) { } ^ Doug and/or Sebastian: I'd appreciate a review, especially the nested-name-spec test results (from the looks of it we now match gcc in that test.) llvm-svn: 67672
* Rename clang to clang-cc.Daniel Dunbar2009-03-241-1/+1
| | | | | | Tests and drivers updated, still need to shuffle dirs. llvm-svn: 67602
* Template instantiation for the declarations of member functions withinDouglas Gregor2009-03-231-2/+1
| | | | | | | | | | | | | | | | | | | | | | a class template. At present, we can only instantiation normal methods, but not constructors, destructors, or conversion operators. As ever, this contains a bit of refactoring in Sema's type-checking. In particular: - Split ActOnFunctionDeclarator into ActOnFunctionDeclarator (handling the declarator itself) and CheckFunctionDeclaration (checking for the the function declaration), the latter of which is also used by template instantiation. - We were performing the adjustment of function parameter types in three places; collect those into a single new routine. - When the type of a parameter is adjusted, allocate an OriginalParmVarDecl to keep track of the type as it was written. - Eliminate a redundant check for out-of-line declarations of member functions; hide more C++-specific checks on function declarations behind if(getLangOptions().CPlusPlus). llvm-svn: 67575
* Fix various problems with matching out-of-line definitions of staticDouglas Gregor2009-03-111-0/+14
| | | | | | | | | class members to the corresponding in-class declaration. Diagnose the erroneous use of 'static' on out-of-line definitions of class members. llvm-svn: 66740
* Add basic, hackish support for instantiation of typedefs in a classDouglas Gregor2009-03-111-2/+6
| | | | | | | | | template. More importantly, start to sort out the issues regarding complete types and nested-name-specifiers, especially the question of: when do we instantiate a class template specialization that occurs to the left of a '::' in a nested-name-specifier? llvm-svn: 66662
* Improve recovery from ill-formed scope specifiers. Fixes PR3670.Douglas Gregor2009-03-061-4/+7
| | | | llvm-svn: 66286
* Make the test cases failing due to exact diagnostic matching XFAIL.Sebastian Redl2009-02-081-0/+2
| | | | llvm-svn: 64080
* Diagnose attempts to define a namespace member out-of-line when noDouglas Gregor2009-02-061-0/+25
| | | | | | matching member exists. Thanks to Piotr Rak for reporting the problem! llvm-svn: 63939
OpenPOWER on IntegriCloud