Commit Graph

19 Commits

Author SHA1 Message Date
Richard Smith 7c2bcc9eb0 Fix clang's handling of the copy performed in the second phase of class
copy-initialization. We previously got this wrong in a couple of ways:
 - we only looked for copy / move constructors and constructor templates for
   this copy, and thus would fail to copy in cases where doing so should use
   some other constructor (but see core issue 670),
 - we mishandled the special case for disabling user-defined conversions that
   blocks infinite recursion through repeated application of a copy constructor
   (applying it in slightly too many cases) -- though as far as I can tell,
   this does not ever actually affect the result of overload resolution, and
 - we misapplied the special-case rules for constructors taking a parameter
   whose type is a (reference to) the same class type by incorrectly assuming
   that only happens for copy/move constructors (it also happens for
   constructors instantiated from templates and those inherited from base
   classes).

These changes should only affect strange corner cases (for instance, where the
copy constructor exists but has a non-const-qualified parameter type), so for
the most part it only causes us to produce more 'candidate' notes, but see the
test changes for other cases whose behavior is affected.

llvm-svn: 280776
2016-09-07 02:14:33 +00:00
Richard Smith e4caa48dbb DR259: Demote the pedantic error for an explicit instantiation after an
explicit specialization to a warning for C++98 mode (this is a defect report
resolution, so per our informal policy it should apply in C++98), and turn
the warning on by default for C++11 and later. In all cases where it fires, the
right thing to do is to remove the pointless explicit instantiation.

llvm-svn: 280308
2016-08-31 23:23:25 +00:00
Nico Weber acb35c0272 Change -Wbind-to-temporary-copy from an ExtWarn to an Extension.
The reasoning is that this construct is accepted by all compilers and valid in
C++11, so it doesn't seem like a useful warning to have enabled by default.
Building with -pedantic, -Wbind-to-temporary-copy, or -Wc++98-compat still
shows the warning.

The motivation is that I built re2, and this was the only warning that was
emitted during the build. Both changing re2 to fix the warning and detecting
clang and suppressing the warning in re2's build seem inferior than just giving
the compiler a good default for this warning.

Also move the cxx98compat version of this warning to CXX98CompatPedantic, and
update tests accordingly.

llvm-svn: 218008
2014-09-18 02:09:53 +00:00
Aaron Ballman dd69ef38db C++1y is now C++14!
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
2014-08-19 15:55:55 +00:00
Richard Smith dd0bc7b560 Remove support for arrays of runtime bound in C++1y, now they have been voted
out of the working paper. This reverts r179962 and r179992.

llvm-svn: 191718
2013-10-01 00:19:43 +00:00
Larisse Voufo 9f380c55ce r184100 Fix -- Updated test cases for contextual conversion
llvm-svn: 184165
2013-06-18 01:27:47 +00:00
Rafael Espindola 09ce33ded0 Revert "Updated test cases for contextual conversion"
This reverts commit r184100.

It was faling on some bots:
http://bb.pgr.jp/builders/cmake-clang-i686-mingw32/builds/1973/steps/test_clang/logs/Clang%20%3A%3A%20SemaCXX__cxx1y-contextual-conversion-tweaks.cpp

llvm-svn: 184108
2013-06-17 19:26:19 +00:00
Larisse Voufo 249f9277a4 Updated test cases for contextual conversion
llvm-svn: 184100
2013-06-17 18:41:38 +00:00
Larisse Voufo d1336faf53 Fixed one buildbot-failure-causing bug...
llvm-svn: 184053
2013-06-16 04:34:07 +00:00
Larisse Voufo 0f1394c86e Updated the support for contextual conversion tweaks (n3323) with a previously overlooked part: implicitly converting array sizes to size_t, rather than contextually converting them to some unique type.
llvm-svn: 184048
2013-06-15 20:17:46 +00:00
Richard Smith 1239d84f77 Use 'c++' not 'cxx' in these diagnostic group names for consistency.
llvm-svn: 182075
2013-05-17 03:11:25 +00:00
Richard Smith 74d0c1eeef Disable VLA diagnostic in C++1y mode, and add some tests.
Still to do here:
  - we have a collection of syntactic accepts-invalids to diagnose
  - support non-PODs in VLAs, including dynamic initialization /
    destruction
  - runtime checks (and throw std::bad_array_length) for bad bound
  - support VLA capture by reference in lambdas
  - properly support VLAs in range-based for (don't recompute bound)

llvm-svn: 179962
2013-04-20 23:28:26 +00:00
Richard Smith c5c27f2a1f Note that we support (and in fact have supported since the dawn of time itself)
C++1y binary literals.

llvm-svn: 179883
2013-04-19 20:47:20 +00:00
Dmitri Gribenko 1cd2305703 Change the wording of the extension warning from
> 'long long' is an extension when C99 mode is not enabled
to
> 'long long' is a C++11 extension
while compiling in C++98 mode.

llvm-svn: 164545
2012-09-24 18:19:21 +00:00
Richard Smith 19b02cd7fc Minor improvements to some C99 variadic-macro-related diagnostics.
llvm-svn: 159054
2012-06-22 23:59:08 +00:00
Richard Smith f411196d15 'extern template' is a C++11 feature. Add an Extension for C++98 (this matches
gcc's behaviour), and a -Wc++98-compat-pedantic warning for C++11.

llvm-svn: 142597
2011-10-20 18:35:58 +00:00
Richard Smith 0bf8a492fd -Wc++98-compat and -Wc++98-compat-pedantic warnings for Sema, part 1.
llvm-svn: 142419
2011-10-18 20:49:44 +00:00
Richard Smith 5d164bc5e0 Implement -Wc++98-compat warnings for the parser.
llvm-svn: 142056
2011-10-15 05:09:34 +00:00
Richard Smith acd4d3d52a -Wc++98-compat warnings for the lexer.
This also adds a -Wc++98-compat-pedantic for warning on constructs which would
be diagnosed by -std=c++98 -pedantic (that is, it warns even on C++11 features
which we enable by default, with no warning, in C++98 mode).

llvm-svn: 142034
2011-10-15 01:18:56 +00:00