summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaTemplate/class-template-decl.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [NFC] Explicitly add -std=c++14 option to tests that rely on the C++14 defaultNemanja Ivanovic2019-02-051-1/+1
| | | | | | | | | | | When Clang/LLVM is built with the CLANG_DEFAULT_STD_CXX CMake macro that sets the default standard to something other than C++14, there are a number of lit tests that fail as they rely on the C++14 default. This patch just adds the language standard option explicitly to such test cases. Differential revision: https://reviews.llvm.org/D57581 llvm-svn: 353163
* Switch to gnu++14 as the default dialect.Tim Northover2017-12-091-2/+1
| | | | | | This is C++14 with conforming GNU extensions. llvm-svn: 320250
* Add a note that points to the linkage specifier for the C++ linkage errorsAlex Lorenz2016-11-021-3/+3
| | | | | | | | | | | | This commit improves the "must have C++ linkage" error diagnostics that are emitted for C++ declarations like templates and literal operators by adding an additional note that points to the appropriate extern "C" linkage specifier. rdar://19021120 Differential Revision: https://reviews.llvm.org/D26189 llvm-svn: 285823
* Test for diagnostic quality improvement in r256049.Richard Smith2015-12-191-0/+7
| | | | llvm-svn: 256083
* Sema: Recover when a function template is in an extern "C" blockDavid Majnemer2015-01-151-0/+6
| | | | llvm-svn: 226135
* C++1y is now C++14!Aaron Ballman2014-08-191-1/+1
| | | | | | Changes diagnostic options, language standard options, diagnostic identifiers, diagnostic wording to use c++14 instead of c++1y. It also modifies related test cases to use the updated diagnostic wording. llvm-svn: 215982
* Sema: Reject templates in all extern "C" contexts.Benjamin Kramer2014-02-021-0/+7
| | | | | | | Otherwise we'd accept them if the LinkageDecl was not the direct parent DeclContext. PR17968. llvm-svn: 200641
* Started implementing variable templates. Top level declarations should be ↵Larisse Voufo2013-08-061-1/+3
| | | | | | fully supported, up to some limitations documented as FIXMEs or TODO. Static data member templates work very partially. Static data member templates of class templates need particular attention... llvm-svn: 187762
* Fix test failure.Richard Smith2012-04-211-3/+3
| | | | llvm-svn: 155271
* When declaring a template, check that the context doesn't already contain aRichard Smith2012-04-211-0/+43
| | | | | | | declaration of the same name. r155187 caused us to miss this if the prior declaration did not declare a type. llvm-svn: 155269
* Replace r155185 with a better fix, which also addresses PR12557. When lookingRichard Smith2012-04-201-10/+0
| | | | | | | | | up an elaborated type specifier in a friend declaration, only look for type declarations, per [basic.lookup.elab]p2. If we know that the redeclaration lookup for a friend class template in a dependent context finds a non-template, don't delay the diagnostic to instantiation time. llvm-svn: 155187
* Fix a bug which creduce found reducing PR12585.Richard Smith2012-04-201-0/+9
| | | | llvm-svn: 155185
* Drastically simplify the mapping from the declaration corresponding toDouglas Gregor2011-11-071-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | the injected-class-name of a class (or class template) to the declaration that results from substituting the given template arguments. Previously, we would actually perform a substitution into the injected-class-name type and then retrieve the resulting declaration. However, in certain, rare circumstances involving deeply-nested member templates, we would get the wrong substitution arguments. This new approach just matches up the declaration with a declaration that's part of the current context (or one of its parents), which will either be an instantiation (during template instantiation) or the declaration itself (during the definition of the template). This is both more efficient (we're avoiding a substitution) and more correct (we can't get the template arguments wrong in the member-template case). Fixes <rdar://problem/9676205>. Reinstated, now that we have the fix in r143967. llvm-svn: 143968
* Revert r143551. It is causing g++.dg/template/crash52.C test failure.Devang Patel2011-11-041-20/+0
| | | | llvm-svn: 143725
* Drastically simplify the mapping from the declaration corresponding toDouglas Gregor2011-11-021-0/+20
| | | | | | | | | | | | | | | | | | | | | | the injected-class-name of a class (or class template) to the declaration that results from substituting the given template arguments. Previously, we would actually perform a substitution into the injected-class-name type and then retrieve the resulting declaration. However, in certain, rare circumstances involving deeply-nested member templates, we would get the wrong substitution arguments. This new approach just matches up the declaration with a declaration that's part of the current context (or one of its parents), which will either be an instantiation (during template instantiation) or the declaration itself (during the definition of the template). This is both more efficient (we're avoiding a substitution) and more correct (we can't get the template arguments wrong in the member-template case). Fixes <rdar://problem/9676205>. llvm-svn: 143551
* When performing name lookup for the previous declaration of a field,Douglas Gregor2011-10-211-0/+1
| | | | | | | | be sure to consider all of the possible lookup results. We were assert()'ing (but behaving correctly) for unresolved values. Fixes PR11134 / <rdar://problem/10290422>. llvm-svn: 142652
* PR10359: Template declarations which define classes are not permitted to ↵Richard Smith2011-07-141-1/+1
| | | | | | | | | | | | also contain declarators. Previously we would accept code like this: template<typename T> struct S { } f() { return 0; } This case now produces a missing ';' diagnostic, since that seems like a much more likely error than an attempt to declare a function or variable in addition to the class template. Treat this llvm-svn: 135195
* Don't lose track of previous-declarations when instantiating a class template.Nick Lewycky2010-11-081-0/+18
| | | | | | Fixes PR8001. llvm-svn: 118454
* Fix a crash-on-invalid involving name lookup of tag names, where weDouglas Gregor2010-04-121-0/+5
| | | | | | | ended up finding a function template that we didn't expect. Recover more gracefully, and fix a similar issue for class templates. llvm-svn: 101040
* 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
* Be a little more careful when trying to extract a TypeDecl from a ↵Douglas Gregor2009-11-051-0/+2
| | | | | | enum/class/struct/union specifier; in invalid code, we may also see ClassTemplateDecls. llvm-svn: 86171
* De-FIXME a testDouglas Gregor2009-11-051-5/+1
| | | | llvm-svn: 86166
* Robustify a bunch of C++-related declaration actions.Douglas Gregor2009-06-221-0/+6
| | | | llvm-svn: 73918
* One can use "class" and "struct" interchangeably to refer to a classDouglas Gregor2009-05-031-4/+1
| | | | | | in C++. Fixes <rdar://problem/6815995>. llvm-svn: 70784
* Rename clang to clang-cc.Daniel Dunbar2009-03-241-1/+1
| | | | | | Tests and drivers updated, still need to shuffle dirs. llvm-svn: 67602
* Fix a long standard problem with clang retaining "too much" sugar Chris Lattner2009-02-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | information about types. We often print diagnostics where we say "foo_t" is bad, but the user doesn't know how foo_t is declared (because it is a typedef). Fix this by expanding sugar when present in a diagnostic (and not one of a few special cases, like vectors). Before: t.m:5:2: error: invalid operands to binary expression ('typeof(P)' and 'typeof(F)') MAX(P, F); ^~~~~~~~~ t.m:1:78: note: instantiated from: #define MAX(A,B) ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? __b : __a; }) ^ After: t.m:5:2: error: invalid operands to binary expression ('typeof(P)' (aka 'struct mystruct') and 'typeof(F)' (aka 'float')) MAX(P, F); ^~~~~~~~~ t.m:1:78: note: instantiated from: #define MAX(A,B) ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? __b : __a; }) ^ llvm-svn: 65081
* Semantic checking for class template declarations andDouglas Gregor2009-02-061-0/+52
redeclarations. For example, checks that a class template redeclaration has the same template parameters as previous declarations. Detangled class-template checking from ActOnTag, whose logic was getting rather convoluted because it tried to handle C, C++, and C++ template semantics in one shot. Made some inroads toward eliminating extraneous "declaration does not declare anything" errors by adding an "error" type specifier. llvm-svn: 63973
OpenPOWER on IntegriCloud