0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

C++N4606(247)20.8.4 Non-member functions [any.nonmembers]p585

Last updated at Posted at 2018-04-30

#はじめに(Introduction)
C++N4606 Working Draft, Standard for Programming Language C++
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/#mailing2016-11
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/n4606.pdf

C++N4606は、ISO/IEC JTC1 SC22 WG21の作業原案(Working Draft)です。
公式のISO/IEC 14882原本ではありません。
ISO/IEC JTC1 SC22 WG21では、可能な限り作業文書を公開し、幅広い意見を求めています。
一連の記事はコード断片をコンパイルできる形にする方法を検討してコンパイル、リンク、実行して、規格案の原文と処理系(g++, Clang++)との違いを確認し、技術内容を検討し、ISO/IEC JTC1 SC22 WG21にフィードバックするために用います。
また、CERT C++, MISRA C++等のコーディング標準のコード断片をコンパイルする際の参考にさせていただこうと考えています。CERT C++, MISRA C++が標準化の動きとの時間的なずれがあれば確認できれば幸いです。また、boostライブラリとの関連、Linux OS, TOPPERSカーネル、g++(GCC), clang++(LLVM)との関係も調査中です。
何か、抜け漏れ、耳より情報がありましたらおしらせくださると幸いです。

##作業方針(sequence)
1)コンパイルエラーを収集する。
2)コンパイルエラーをなくす方法を検討する。
コンパイルエラーになる例を示すだけが目的のコードは、コンパイルエラーをなくすのではなく、コンパイルエラーの種類を収集するだけにする。
文法を示すのが目的のコード場合に、コンパイルエラーをなくすのに手間がかかる場合は、順次作業します。
3)リンクエラーをなくす方法を検討する。
文法を示すのが目的のコード場合に、リンクエラーをなくすのに手間がかかる場合は、順次作業します。
4)意味のある出力を作る。
コンパイル、リンクが通っても、意味のある出力を示そうとすると、コンパイル・リンクエラーが出て収拾できそうにない場合がある。順次作業します。

1)だけのものから4)まで進んだものと色々ある状態です。一歩でも前に進むご助言をお待ちしています。「検討事項」の欄に現状を記録するようにしています。

C++N4606符号断片編纂一覧(example code compile list)

C++N4606 Working Draft 2016, ISO/IEC 14882, C++ standard(1) Example code compile list
https://qiita.com/kaizen_nagoya/items/df5d62c35bd6ed1c3d43/

編纂器(Compiler)

###clang++ --version
clang version 6.0.0 (tags/RELEASE_600/final)
Target: x86_64-apple-darwin17.4.0

###g++-7 --version
g++-7 (Homebrew GCC 7.3.0_1) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.

#(247)20.8.4 Non-member functions [any.nonmembers]p585
##算譜(source code)

p554.cpp
// C++N4606 Committee Draft, Standard for Programming Language C++
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/n4606.pdf
#define msg "C++N4606(247)20.8.4 Non-member functions [any.nonmembers]p585.cpp"
// Edited by Dr. Ogawa Kiyoshi. Compile procedure and results record.

#include <iostream>
#include <cstdlib>
#include <cassert>

#define any int

any x(5); // x holds int
assert(any_cast<int>(x) == 5); // cast to value
any_cast<int&>(x) = 10; // cast to reference
assert(any_cast<int>(x) == 10);
x = "Meow"; // x holds const char*
assert(strcmp(any_cast<const char*>(x), "Meow") == 0);
any_cast<const char*&>(x) = "Harry";
assert(strcmp(any_cast<const char*>(x), "Harry") == 0);
x = string("Meow"); // x holds string
string s, s2("Jane");
s = move(any_cast<string&>(x)); // move from any
assert(s == "Meow");
any_cast<string&>(x) = move(s2); // move to any
assert(any_cast<const string&>(x) == "Jane");
string cat("Meow");
const any y(cat); // const y holds string
assert(any_cast<const string&>(y) == cat);
any_cast<string&>(y); // error; cannot
// any_cast away const

bool is_string(const any& operand) {
  return any_cast<string>(&operand) != nullptr;
}

int main() {
  std::cout<< msg << std::endl;
  return EXIT_SUCCESS;
}

##編纂・実行結果(compile and go)

$ ./cppall.sh p585
$ clang++ p585.cpp -std=c++03 -Wall
p585.cpp:13:1: error: expected parameter declarator
assert(any_cast<int>(x) == 5); // cast to value
^
/usr/include/assert.h:93:23: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                      ^
p585.cpp:13:1: error: expected ')'
/usr/include/assert.h:93:23: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                      ^
p585.cpp:13:1: note: to match this '('
/usr/include/assert.h:93:22: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                     ^
p585.cpp:13:1: error: expected ')'
assert(any_cast<int>(x) == 5); // cast to value
^
/usr/include/assert.h:93:32: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                               ^
p585.cpp:13:1: note: to match this '('
/usr/include/assert.h:93:5: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
    ^
p585.cpp:13:1: error: C++ requires a type specifier for all declarations
assert(any_cast<int>(x) == 5); // cast to value
^
/usr/include/assert.h:93:6: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
     ^
p585.cpp:14:1: error: no template named 'any_cast'
any_cast<int&>(x) = 10; // cast to reference
^
p585.cpp:15:1: error: expected parameter declarator
assert(any_cast<int>(x) == 10);
^
/usr/include/assert.h:93:23: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                      ^
p585.cpp:15:1: error: expected ')'
/usr/include/assert.h:93:23: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                      ^
p585.cpp:15:1: note: to match this '('
/usr/include/assert.h:93:22: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                     ^
p585.cpp:15:1: error: expected ')'
assert(any_cast<int>(x) == 10);
^
/usr/include/assert.h:93:32: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                               ^
p585.cpp:15:1: note: to match this '('
/usr/include/assert.h:93:5: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
    ^
p585.cpp:15:1: error: C++ requires a type specifier for all declarations
assert(any_cast<int>(x) == 10);
^
/usr/include/assert.h:93:6: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
     ^
p585.cpp:16:1: error: C++ requires a type specifier for all declarations
x = "Meow"; // x holds const char*
^
p585.cpp:17:1: error: expected parameter declarator
assert(strcmp(any_cast<const char*>(x), "Meow") == 0);
^
/usr/include/assert.h:93:23: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                      ^
p585.cpp:17:1: error: expected ')'
/usr/include/assert.h:93:23: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                      ^
p585.cpp:17:1: note: to match this '('
/usr/include/assert.h:93:22: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                     ^
p585.cpp:17:1: error: expected ')'
assert(strcmp(any_cast<const char*>(x), "Meow") == 0);
^
/usr/include/assert.h:93:32: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                               ^
p585.cpp:17:1: note: to match this '('
/usr/include/assert.h:93:5: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
    ^
p585.cpp:17:1: error: C++ requires a type specifier for all declarations
assert(strcmp(any_cast<const char*>(x), "Meow") == 0);
^
/usr/include/assert.h:93:6: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
     ^
p585.cpp:18:1: error: no template named 'any_cast'
any_cast<const char*&>(x) = "Harry";
^
p585.cpp:19:1: error: expected parameter declarator
assert(strcmp(any_cast<const char*>(x), "Harry") == 0);
^
/usr/include/assert.h:93:23: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                      ^
p585.cpp:19:1: error: expected ')'
/usr/include/assert.h:93:23: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                      ^
p585.cpp:19:1: note: to match this '('
/usr/include/assert.h:93:22: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                     ^
p585.cpp:19:1: error: expected ')'
assert(strcmp(any_cast<const char*>(x), "Harry") == 0);
^
/usr/include/assert.h:93:32: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                               ^
p585.cpp:19:1: note: to match this '('
/usr/include/assert.h:93:5: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
    ^
p585.cpp:19:1: error: C++ requires a type specifier for all declarations
assert(strcmp(any_cast<const char*>(x), "Harry") == 0);
^
/usr/include/assert.h:93:6: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
     ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
$ clang++ p585.cpp -std=c++11 -Wall
p585.cpp:13:1: error: expected parameter declarator
assert(any_cast<int>(x) == 5); // cast to value
^
/usr/include/assert.h:93:23: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                      ^
p585.cpp:13:1: error: expected ')'
/usr/include/assert.h:93:23: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                      ^
p585.cpp:13:1: note: to match this '('
/usr/include/assert.h:93:22: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                     ^
p585.cpp:13:1: error: expected ')'
assert(any_cast<int>(x) == 5); // cast to value
^
/usr/include/assert.h:93:32: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                               ^
p585.cpp:13:1: note: to match this '('
/usr/include/assert.h:93:5: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
    ^
p585.cpp:13:1: error: C++ requires a type specifier for all declarations
assert(any_cast<int>(x) == 5); // cast to value
^
/usr/include/assert.h:93:6: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
     ^
p585.cpp:14:1: error: no template named 'any_cast'
any_cast<int&>(x) = 10; // cast to reference
^
p585.cpp:15:1: error: expected parameter declarator
assert(any_cast<int>(x) == 10);
^
/usr/include/assert.h:93:23: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                      ^
p585.cpp:15:1: error: expected ')'
/usr/include/assert.h:93:23: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                      ^
p585.cpp:15:1: note: to match this '('
/usr/include/assert.h:93:22: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                     ^
p585.cpp:15:1: error: expected ')'
assert(any_cast<int>(x) == 10);
^
/usr/include/assert.h:93:32: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                               ^
p585.cpp:15:1: note: to match this '('
/usr/include/assert.h:93:5: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
    ^
p585.cpp:15:1: error: C++ requires a type specifier for all declarations
assert(any_cast<int>(x) == 10);
^
/usr/include/assert.h:93:6: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
     ^
p585.cpp:16:1: error: C++ requires a type specifier for all declarations
x = "Meow"; // x holds const char*
^
p585.cpp:17:1: error: expected parameter declarator
assert(strcmp(any_cast<const char*>(x), "Meow") == 0);
^
/usr/include/assert.h:93:23: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                      ^
p585.cpp:17:1: error: expected ')'
/usr/include/assert.h:93:23: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                      ^
p585.cpp:17:1: note: to match this '('
/usr/include/assert.h:93:22: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                     ^
p585.cpp:17:1: error: expected ')'
assert(strcmp(any_cast<const char*>(x), "Meow") == 0);
^
/usr/include/assert.h:93:32: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                               ^
p585.cpp:17:1: note: to match this '('
/usr/include/assert.h:93:5: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
    ^
p585.cpp:17:1: error: C++ requires a type specifier for all declarations
assert(strcmp(any_cast<const char*>(x), "Meow") == 0);
^
/usr/include/assert.h:93:6: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
     ^
p585.cpp:18:1: error: no template named 'any_cast'
any_cast<const char*&>(x) = "Harry";
^
p585.cpp:19:1: error: expected parameter declarator
assert(strcmp(any_cast<const char*>(x), "Harry") == 0);
^
/usr/include/assert.h:93:23: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                      ^
p585.cpp:19:1: error: expected ')'
/usr/include/assert.h:93:23: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                      ^
p585.cpp:19:1: note: to match this '('
/usr/include/assert.h:93:22: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                     ^
p585.cpp:19:1: error: expected ')'
assert(strcmp(any_cast<const char*>(x), "Harry") == 0);
^
/usr/include/assert.h:93:32: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                               ^
p585.cpp:19:1: note: to match this '('
/usr/include/assert.h:93:5: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
    ^
p585.cpp:19:1: error: C++ requires a type specifier for all declarations
assert(strcmp(any_cast<const char*>(x), "Harry") == 0);
^
/usr/include/assert.h:93:6: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
     ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
$ clang++ p585.cpp -std=c++17 -Wall
p585.cpp:13:1: error: expected parameter declarator
assert(any_cast<int>(x) == 5); // cast to value
^
/usr/include/assert.h:93:23: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                      ^
p585.cpp:13:1: error: expected ')'
/usr/include/assert.h:93:23: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                      ^
p585.cpp:13:1: note: to match this '('
/usr/include/assert.h:93:22: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                     ^
p585.cpp:13:1: error: expected ')'
assert(any_cast<int>(x) == 5); // cast to value
^
/usr/include/assert.h:93:32: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                               ^
p585.cpp:13:1: note: to match this '('
/usr/include/assert.h:93:5: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
    ^
p585.cpp:13:1: error: C++ requires a type specifier for all declarations
assert(any_cast<int>(x) == 5); // cast to value
^
/usr/include/assert.h:93:6: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
     ^
p585.cpp:14:1: error: no template named 'any_cast'
any_cast<int&>(x) = 10; // cast to reference
^
p585.cpp:15:1: error: expected parameter declarator
assert(any_cast<int>(x) == 10);
^
/usr/include/assert.h:93:23: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                      ^
p585.cpp:15:1: error: expected ')'
/usr/include/assert.h:93:23: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                      ^
p585.cpp:15:1: note: to match this '('
/usr/include/assert.h:93:22: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                     ^
p585.cpp:15:1: error: expected ')'
assert(any_cast<int>(x) == 10);
^
/usr/include/assert.h:93:32: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                               ^
p585.cpp:15:1: note: to match this '('
/usr/include/assert.h:93:5: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
    ^
p585.cpp:15:1: error: C++ requires a type specifier for all declarations
assert(any_cast<int>(x) == 10);
^
/usr/include/assert.h:93:6: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
     ^
p585.cpp:16:1: error: C++ requires a type specifier for all declarations
x = "Meow"; // x holds const char*
^
p585.cpp:17:1: error: expected parameter declarator
assert(strcmp(any_cast<const char*>(x), "Meow") == 0);
^
/usr/include/assert.h:93:23: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                      ^
p585.cpp:17:1: error: expected ')'
/usr/include/assert.h:93:23: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                      ^
p585.cpp:17:1: note: to match this '('
/usr/include/assert.h:93:22: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                     ^
p585.cpp:17:1: error: expected ')'
assert(strcmp(any_cast<const char*>(x), "Meow") == 0);
^
/usr/include/assert.h:93:32: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                               ^
p585.cpp:17:1: note: to match this '('
/usr/include/assert.h:93:5: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
    ^
p585.cpp:17:1: error: C++ requires a type specifier for all declarations
assert(strcmp(any_cast<const char*>(x), "Meow") == 0);
^
/usr/include/assert.h:93:6: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
     ^
p585.cpp:18:1: error: no template named 'any_cast'
any_cast<const char*&>(x) = "Harry";
^
p585.cpp:19:1: error: expected parameter declarator
assert(strcmp(any_cast<const char*>(x), "Harry") == 0);
^
/usr/include/assert.h:93:23: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                      ^
p585.cpp:19:1: error: expected ')'
/usr/include/assert.h:93:23: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                      ^
p585.cpp:19:1: note: to match this '('
/usr/include/assert.h:93:22: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                     ^
p585.cpp:19:1: error: expected ')'
assert(strcmp(any_cast<const char*>(x), "Harry") == 0);
^
/usr/include/assert.h:93:32: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                               ^
p585.cpp:19:1: note: to match this '('
/usr/include/assert.h:93:5: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
    ^
p585.cpp:19:1: error: C++ requires a type specifier for all declarations
assert(strcmp(any_cast<const char*>(x), "Harry") == 0);
^
/usr/include/assert.h:93:6: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
     ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

$ g++-7 p585.cpp -std=c++03  -Wall
p585.cpp:33:3: warning: identifier 'nullptr' is a keyword in C++11 [-Wc++11-compat]
   return any_cast<string>(&operand) != nullptr;
   ^~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cassert:44:0,
                 from p585.cpp:8:
p585.cpp:13:1: error: expected ')' before '(' token
 assert(any_cast<int>(x) == 5); // cast to value
 ^
p585.cpp:14:1: error: 'any_cast' does not name a type; did you mean 'ru_last'?
 any_cast<int&>(x) = 10; // cast to reference
 ^~~~~~~~
 ru_last
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cassert:44:0,
                 from p585.cpp:8:
p585.cpp:15:1: error: expected ')' before '(' token
 assert(any_cast<int>(x) == 10);
 ^
p585.cpp:16:1: error: 'x' does not name a type
 x = "Meow"; // x holds const char*
 ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cassert:44:0,
                 from p585.cpp:8:
p585.cpp:17:1: error: expected ')' before '(' token
 assert(strcmp(any_cast<const char*>(x), "Meow") == 0);
 ^
p585.cpp:18:1: error: 'any_cast' does not name a type; did you mean 'ru_last'?
 any_cast<const char*&>(x) = "Harry";
 ^~~~~~~~
 ru_last
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cassert:44:0,
                 from p585.cpp:8:
p585.cpp:19:1: error: expected ')' before '(' token
 assert(strcmp(any_cast<const char*>(x), "Harry") == 0);
 ^
p585.cpp:20:1: error: 'x' does not name a type
 x = string("Meow"); // x holds string
 ^
p585.cpp:21:1: error: 'string' does not name a type; did you mean 'stdin'?
 string s, s2("Jane");
 ^~~~~~
 stdin
p585.cpp:22:1: error: 's' does not name a type
 s = move(any_cast<string&>(x)); // move from any
 ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cassert:44:0,
                 from p585.cpp:8:
p585.cpp:23:1: error: expected ')' before '(' token
 assert(s == "Meow");
 ^
p585.cpp:24:1: error: 'any_cast' does not name a type; did you mean 'ru_last'?
 any_cast<string&>(x) = move(s2); // move to any
 ^~~~~~~~
 ru_last
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cassert:44:0,
                 from p585.cpp:8:
p585.cpp:25:1: error: expected ')' before '(' token
 assert(any_cast<const string&>(x) == "Jane");
 ^
p585.cpp:26:1: error: 'string' does not name a type; did you mean 'stdin'?
 string cat("Meow");
 ^~~~~~
 stdin
p585.cpp:27:13: error: 'cat' was not declared in this scope
 const any y(cat); // const y holds string
             ^~~
p585.cpp:27:13: note: suggested alternative: 'gcvt'
 const any y(cat); // const y holds string
             ^~~
             gcvt
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cassert:44:0,
                 from p585.cpp:8:
p585.cpp:28:1: error: expected ')' before '(' token
 assert(any_cast<const string&>(y) == cat);
 ^
p585.cpp:29:1: error: 'any_cast' does not name a type; did you mean 'ru_last'?
 any_cast<string&>(y); // error; cannot
 ^~~~~~~~
 ru_last
p585.cpp: In function 'bool is_string(const int&)':
p585.cpp:33:10: error: 'any_cast' was not declared in this scope
   return any_cast<string>(&operand) != nullptr;
          ^~~~~~~~
p585.cpp:33:10: note: suggested alternative: 'ru_last'
   return any_cast<string>(&operand) != nullptr;
          ^~~~~~~~
          ru_last
p585.cpp:33:19: error: 'string' was not declared in this scope
   return any_cast<string>(&operand) != nullptr;
                   ^~~~~~
p585.cpp:33:19: note: suggested alternatives:
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iosfwd:39:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p585.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stringfwd.h:74:33: note:   'std::__cxx11::string'
   typedef basic_string<char>    string;
                                 ^~~~~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stringfwd.h:74:33: note:   'std::__cxx11::string'
p585.cpp:33:40: error: 'nullptr' was not declared in this scope
   return any_cast<string>(&operand) != nullptr;
                                        ^~~~~~~

$ g++-7 p585.cpp -std=c++11  -Wall
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cassert:44:0,
                 from p585.cpp:8:
p585.cpp:13:1: error: expected ')' before '(' token
 assert(any_cast<int>(x) == 5); // cast to value
 ^
p585.cpp:14:1: error: 'any_cast' does not name a type; did you mean 'ru_last'?
 any_cast<int&>(x) = 10; // cast to reference
 ^~~~~~~~
 ru_last
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cassert:44:0,
                 from p585.cpp:8:
p585.cpp:15:1: error: expected ')' before '(' token
 assert(any_cast<int>(x) == 10);
 ^
p585.cpp:16:1: error: 'x' does not name a type
 x = "Meow"; // x holds const char*
 ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cassert:44:0,
                 from p585.cpp:8:
p585.cpp:17:1: error: expected ')' before '(' token
 assert(strcmp(any_cast<const char*>(x), "Meow") == 0);
 ^
p585.cpp:18:1: error: 'any_cast' does not name a type; did you mean 'ru_last'?
 any_cast<const char*&>(x) = "Harry";
 ^~~~~~~~
 ru_last
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cassert:44:0,
                 from p585.cpp:8:
p585.cpp:19:1: error: expected ')' before '(' token
 assert(strcmp(any_cast<const char*>(x), "Harry") == 0);
 ^
p585.cpp:20:1: error: 'x' does not name a type
 x = string("Meow"); // x holds string
 ^
p585.cpp:21:1: error: 'string' does not name a type; did you mean 'stdin'?
 string s, s2("Jane");
 ^~~~~~
 stdin
p585.cpp:22:1: error: 's' does not name a type
 s = move(any_cast<string&>(x)); // move from any
 ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cassert:44:0,
                 from p585.cpp:8:
p585.cpp:23:1: error: expected ')' before '(' token
 assert(s == "Meow");
 ^
p585.cpp:24:1: error: 'any_cast' does not name a type; did you mean 'ru_last'?
 any_cast<string&>(x) = move(s2); // move to any
 ^~~~~~~~
 ru_last
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cassert:44:0,
                 from p585.cpp:8:
p585.cpp:25:1: error: expected ')' before '(' token
 assert(any_cast<const string&>(x) == "Jane");
 ^
p585.cpp:26:1: error: 'string' does not name a type; did you mean 'stdin'?
 string cat("Meow");
 ^~~~~~
 stdin
p585.cpp:27:13: error: 'cat' was not declared in this scope
 const any y(cat); // const y holds string
             ^~~
p585.cpp:27:13: note: suggested alternative: 'gcvt'
 const any y(cat); // const y holds string
             ^~~
             gcvt
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cassert:44:0,
                 from p585.cpp:8:
p585.cpp:28:1: error: expected ')' before '(' token
 assert(any_cast<const string&>(y) == cat);
 ^
p585.cpp:29:1: error: 'any_cast' does not name a type; did you mean 'ru_last'?
 any_cast<string&>(y); // error; cannot
 ^~~~~~~~
 ru_last
p585.cpp: In function 'bool is_string(const int&)':
p585.cpp:33:10: error: 'any_cast' was not declared in this scope
   return any_cast<string>(&operand) != nullptr;
          ^~~~~~~~
p585.cpp:33:10: note: suggested alternative: 'ru_last'
   return any_cast<string>(&operand) != nullptr;
          ^~~~~~~~
          ru_last
p585.cpp:33:19: error: 'string' was not declared in this scope
   return any_cast<string>(&operand) != nullptr;
                   ^~~~~~
p585.cpp:33:19: note: suggested alternatives:
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iosfwd:39:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p585.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stringfwd.h:74:33: note:   'std::__cxx11::string'
   typedef basic_string<char>    string;
                                 ^~~~~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stringfwd.h:74:33: note:   'std::__cxx11::string'

$ g++-7 p585.cpp -std=c++17  -Wall
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cassert:44:0,
                 from p585.cpp:8:
p585.cpp:13:1: error: expected ')' before '(' token
 assert(any_cast<int>(x) == 5); // cast to value
 ^
p585.cpp:14:1: error: 'any_cast' does not name a type; did you mean 'ru_last'?
 any_cast<int&>(x) = 10; // cast to reference
 ^~~~~~~~
 ru_last
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cassert:44:0,
                 from p585.cpp:8:
p585.cpp:15:1: error: expected ')' before '(' token
 assert(any_cast<int>(x) == 10);
 ^
p585.cpp:16:1: error: 'x' does not name a type
 x = "Meow"; // x holds const char*
 ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cassert:44:0,
                 from p585.cpp:8:
p585.cpp:17:1: error: expected ')' before '(' token
 assert(strcmp(any_cast<const char*>(x), "Meow") == 0);
 ^
p585.cpp:18:1: error: 'any_cast' does not name a type; did you mean 'ru_last'?
 any_cast<const char*&>(x) = "Harry";
 ^~~~~~~~
 ru_last
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cassert:44:0,
                 from p585.cpp:8:
p585.cpp:19:1: error: expected ')' before '(' token
 assert(strcmp(any_cast<const char*>(x), "Harry") == 0);
 ^
p585.cpp:20:1: error: 'x' does not name a type
 x = string("Meow"); // x holds string
 ^
p585.cpp:21:1: error: 'string' does not name a type; did you mean 'stdin'?
 string s, s2("Jane");
 ^~~~~~
 stdin
p585.cpp:22:1: error: 's' does not name a type
 s = move(any_cast<string&>(x)); // move from any
 ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cassert:44:0,
                 from p585.cpp:8:
p585.cpp:23:1: error: expected ')' before '(' token
 assert(s == "Meow");
 ^
p585.cpp:24:1: error: 'any_cast' does not name a type; did you mean 'ru_last'?
 any_cast<string&>(x) = move(s2); // move to any
 ^~~~~~~~
 ru_last
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cassert:44:0,
                 from p585.cpp:8:
p585.cpp:25:1: error: expected ')' before '(' token
 assert(any_cast<const string&>(x) == "Jane");
 ^
p585.cpp:26:1: error: 'string' does not name a type; did you mean 'stdin'?
 string cat("Meow");
 ^~~~~~
 stdin
p585.cpp:27:13: error: 'cat' was not declared in this scope
 const any y(cat); // const y holds string
             ^~~
p585.cpp:27:13: note: suggested alternative: 'gcvt'
 const any y(cat); // const y holds string
             ^~~
             gcvt
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cassert:44:0,
                 from p585.cpp:8:
p585.cpp:28:1: error: expected ')' before '(' token
 assert(any_cast<const string&>(y) == cat);
 ^
p585.cpp:29:1: error: 'any_cast' does not name a type; did you mean 'ru_last'?
 any_cast<string&>(y); // error; cannot
 ^~~~~~~~
 ru_last
p585.cpp: In function 'bool is_string(const int&)':
p585.cpp:33:10: error: 'any_cast' was not declared in this scope
   return any_cast<string>(&operand) != nullptr;
          ^~~~~~~~
p585.cpp:33:10: note: suggested alternative: 'ru_last'
   return any_cast<string>(&operand) != nullptr;
          ^~~~~~~~
          ru_last
p585.cpp:33:19: error: 'string' was not declared in this scope
   return any_cast<string>(&operand) != nullptr;
                   ^~~~~~
p585.cpp:33:19: note: suggested alternatives:
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iosfwd:39:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p585.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stringfwd.h:74:33: note:   'std::__cxx11::string'
   typedef basic_string<char>    string;
                                 ^~~~~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stringfwd.h:74:33: note:   'std::__cxx11::string'

boost/any.hppをincludeしboost::をany_castにつける。

###算譜(source code)

p554a.cpp
// C++N4606 Committee Draft, Standard for Programming Language C++
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/n4606.pdf
#define msg "C++N4606(247)20.8.4 Non-member functions [any.nonmembers]p585.cpp"
// Edited by Dr. Ogawa Kiyoshi. Compile procedure and results record.

#include <iostream>
#include <cstdlib>
#include <cassert>
#include <boost/any.hpp>

#define any int

any x(5); // x holds int
assert(boost::any_cast<int>(x) == 5); // cast to value
boost::any_cast<int&>(x) = 10; // cast to reference
assert(boost::any_cast<int>(x) == 10);
x = "Meow"; // x holds const char*
assert(strcmp(boost::any_cast<const char*>(x), "Meow") == 0);
boost::any_cast<const char*&>(x) = "Harry";
assert(strcmp(boost::any_cast<const char*>(x), "Harry") == 0);
x = string("Meow"); // x holds string
string s, s2("Jane");
s = move(boost::any_cast<string&>(x)); // move from any
assert(s == "Meow");
boost::any_cast<string&>(x) = move(s2); // move to any
assert(boost::any_cast<const string&>(x) == "Jane");
string cat("Meow");
const any y(cat); // const y holds string
assert(boost::any_cast<const string&>(y) == cat);
boost::any_cast<string&>(y); // error; cannot
// any_cast away const

bool is_string(const any& operand) {
  return boost::any_cast<string>(&operand) != nullptr;
}

int main() {
  std::cout<< msg << std::endl;
  return EXIT_SUCCESS;
}

##編纂・実行結果(compile and go)

cppall.sh
$ ./cppall.sh p585a
$ clang++ p585a.cpp -std=c++03 -Wall
p585a.cpp:14:5: error: cannot initialize a variable of type 'char *' with an rvalue of type 'int'
any x(5); // x holds int
    ^ ~
p585a.cpp:29:11: error: no viable conversion from 'std::string' (aka 'basic_string<char, char_traits<char>, allocator<char> >') to 'const char *'
const any y(cat); // const y holds string
          ^ ~~~
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/string:823:5: note: candidate function
    operator __self_view() const _NOEXCEPT { return __self_view(data(), size()); }
    ^
p585a.cpp:36:50: error: invalid operands to binary expression ('std::__1::basic_string<char>' and 'std::__1::nullptr_t')
  return (boost::any_cast<std::string>(&operand) != nullptr);
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__nullptr:44:57: note: candidate function not viable: no known conversion from 'std::__1::basic_string<char>' to
      'std::__1::nullptr_t' for 1st argument
    friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator!=(nullptr_t, nullptr_t) {return false;}
                                                        ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/system_error:606:1: note: candidate function not viable: no known conversion from 'std::__1::basic_string<char>'
      to 'const std::__1::error_code' for 1st argument
operator!=(const error_code& __x, const error_code& __y) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/system_error:611:1: note: candidate function not viable: no known conversion from 'std::__1::basic_string<char>'
      to 'const std::__1::error_code' for 1st argument
operator!=(const error_code& __x, const error_condition& __y) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/system_error:616:1: note: candidate function not viable: no known conversion from 'std::__1::basic_string<char>'
      to 'const std::__1::error_condition' for 1st argument
operator!=(const error_condition& __x, const error_code& __y) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/system_error:621:1: note: candidate function not viable: no known conversion from 'std::__1::basic_string<char>'
      to 'const std::__1::error_condition' for 1st argument
operator!=(const error_condition& __x, const error_condition& __y) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/utility:564:1: note: candidate template ignored: could not match 'pair' against 'basic_string'
operator!=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/iterator:710:1: note: candidate template ignored: could not match 'reverse_iterator' against 'basic_string'
operator!=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/iterator:932:1: note: candidate template ignored: could not match 'istream_iterator' against 'basic_string'
operator!=(const istream_iterator<_Tp, _CharT, _Traits, _Distance>& __x,
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/iterator:1033:6: note: candidate template ignored: could not match 'istreambuf_iterator' against 'basic_string'
bool operator!=(const istreambuf_iterator<_CharT,_Traits>& __a,
     ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/iterator:1151:1: note: candidate template ignored: could not match 'move_iterator' against 'basic_string'
operator!=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/iterator:1524:1: note: candidate template ignored: could not match '__wrap_iter' against 'basic_string'
operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/iterator:1556:1: note: candidate template ignored: could not match '__wrap_iter' against 'basic_string'
operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT_DEBUG
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/memory:1965:6: note: candidate template ignored: could not match 'allocator' against 'basic_string'
bool operator!=(const allocator<_Tp>&, const allocator<_Up>&) _NOEXCEPT {return false;}
     ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/memory:2915:1: note: candidate template ignored: could not match 'unique_ptr' against 'basic_string'
operator!=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return !(__x == __y);}
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/memory:2962:1: note: candidate template ignored: could not match 'unique_ptr' against 'basic_string'
operator!=(const unique_ptr<_T1, _D1>& __x, nullptr_t) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/memory:2970:1: note: candidate template ignored: could not match 'unique_ptr<type-parameter-0-0,
      type-parameter-0-1>' against 'std::__1::nullptr_t'
operator!=(nullptr_t, const unique_ptr<_T1, _D1>& __x) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/memory:4750:1: note: candidate template ignored: could not match 'shared_ptr' against 'basic_string'
operator!=(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/memory:4807:1: note: candidate template ignored: could not match 'shared_ptr' against 'basic_string'
operator!=(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/memory:4815:1: note: candidate template ignored: could not match 'shared_ptr<type-parameter-0-0>' against
      'std::__1::nullptr_t'
operator!=(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/string_view:640:6: note: candidate template ignored: could not match 'basic_string_view' against 'basic_string'
bool operator!=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
     ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/string_view:649:6: note: candidate template ignored: could not match 'basic_string_view' against 'basic_string'
bool operator!=(basic_string_view<_CharT, _Traits> __lhs,
     ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/string_view:659:6: note: candidate template ignored: could not match 'basic_string_view<type-parameter-0-0,
      type-parameter-0-1>' against 'std::__1::nullptr_t'
bool operator!=(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs, 
     ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/string:540:6: note: candidate template ignored: could not match 'fpos' against 'basic_string'
bool operator!=(const fpos<_StateT>& __x, const fpos<_StateT>& __y)
     ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/string:3621:1: note: candidate template ignored: could not match 'basic_string<type-parameter-0-0,
      type-parameter-0-1, type-parameter-0-2>' against 'std::__1::nullptr_t'
operator!=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/string:3630:1: note: candidate template ignored: could not match 'const _CharT *' against
      'std::__1::basic_string<char>'
operator!=(const _CharT* __lhs,
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/string:3639:1: note: candidate template ignored: could not match 'const _CharT *' against 'std::__1::nullptr_t'
operator!=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__functional_03:1563:1: note: candidate template ignored: could not match 'function' against 'basic_string'
operator!=(const function<_Fp>& __f, nullptr_t) {return (bool)__f;}
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__functional_03:1568:1: note: candidate template ignored: could not match 'function<type-parameter-0-0>' against
      'std::__1::nullptr_t'
operator!=(nullptr_t, const function<_Fp>& __f) {return (bool)__f;}
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/deque:2860:1: note: candidate template ignored: could not match 'deque' against 'basic_string'
operator!=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/list:2379:1: note: candidate template ignored: could not match 'list' against 'basic_string'
operator!=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/vector:3318:1: note: candidate template ignored: could not match 'vector' against 'basic_string'
operator!=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y)
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/map:1416:1: note: candidate template ignored: could not match 'map' against 'basic_string'
operator!=(const map<_Key, _Tp, _Compare, _Allocator>& __x,
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/map:1881:1: note: candidate template ignored: could not match 'multimap' against 'basic_string'
operator!=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/set:763:1: note: candidate template ignored: could not match 'set' against 'basic_string'
operator!=(const set<_Key, _Compare, _Allocator>& __x,
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/set:1173:1: note: candidate template ignored: could not match 'multiset' against 'basic_string'
operator!=(const multiset<_Key, _Compare, _Allocator>& __x,
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/complex:772:1: note: candidate template ignored: could not match 'complex' against 'basic_string'
operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y)
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/complex:780:1: note: candidate template ignored: could not match 'complex' against 'basic_string'
operator!=(const complex<_Tp>& __x, const _Tp& __y)
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/complex:788:1: note: candidate template ignored: could not match 'complex<type-parameter-0-0>' against
      'std::__1::nullptr_t'
operator!=(const _Tp& __x, const complex<_Tp>& __y)
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/array:241:1: note: candidate template ignored: could not match 'array' against 'basic_string'
operator!=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
^
3 errors generated.
$ clang++ p585a.cpp -std=c++11 -Wall
p585a.cpp:14:5: error: cannot initialize a variable of type 'char *' with an rvalue of type 'int'
any x(5); // x holds int
    ^ ~
p585a.cpp:29:11: error: no viable conversion from 'std::string' (aka 'basic_string<char, char_traits<char>, allocator<char> >') to 'const char *'
const any y(cat); // const y holds string
          ^ ~~~
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/string:823:5: note: candidate function
    operator __self_view() const _NOEXCEPT { return __self_view(data(), size()); }
    ^
p585a.cpp:36:50: error: invalid operands to binary expression ('std::__1::basic_string<char>' and 'nullptr_t')
  return (boost::any_cast<std::string>(&operand) != nullptr);
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/system_error:606:1: note: candidate function not viable: no known conversion from 'std::__1::basic_string<char>'
      to 'const std::__1::error_code' for 1st argument
operator!=(const error_code& __x, const error_code& __y) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/system_error:611:1: note: candidate function not viable: no known conversion from 'std::__1::basic_string<char>'
      to 'const std::__1::error_code' for 1st argument
operator!=(const error_code& __x, const error_condition& __y) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/system_error:616:1: note: candidate function not viable: no known conversion from 'std::__1::basic_string<char>'
      to 'const std::__1::error_condition' for 1st argument
operator!=(const error_condition& __x, const error_code& __y) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/system_error:621:1: note: candidate function not viable: no known conversion from 'std::__1::basic_string<char>'
      to 'const std::__1::error_condition' for 1st argument
operator!=(const error_condition& __x, const error_condition& __y) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/utility:564:1: note: candidate template ignored: could not match 'pair' against 'basic_string'
operator!=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/iterator:710:1: note: candidate template ignored: could not match 'reverse_iterator' against 'basic_string'
operator!=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/iterator:932:1: note: candidate template ignored: could not match 'istream_iterator' against 'basic_string'
operator!=(const istream_iterator<_Tp, _CharT, _Traits, _Distance>& __x,
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/iterator:1033:6: note: candidate template ignored: could not match 'istreambuf_iterator' against 'basic_string'
bool operator!=(const istreambuf_iterator<_CharT,_Traits>& __a,
     ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/iterator:1151:1: note: candidate template ignored: could not match 'move_iterator' against 'basic_string'
operator!=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/iterator:1524:1: note: candidate template ignored: could not match '__wrap_iter' against 'basic_string'
operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/iterator:1556:1: note: candidate template ignored: could not match '__wrap_iter' against 'basic_string'
operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT_DEBUG
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/tuple:1152:1: note: candidate template ignored: could not match 'tuple' against 'basic_string'
operator!=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/memory:1965:6: note: candidate template ignored: could not match 'allocator' against 'basic_string'
bool operator!=(const allocator<_Tp>&, const allocator<_Up>&) _NOEXCEPT {return false;}
     ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/memory:2915:1: note: candidate template ignored: could not match 'unique_ptr' against 'basic_string'
operator!=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return !(__x == __y);}
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/memory:2962:1: note: candidate template ignored: could not match 'unique_ptr' against 'basic_string'
operator!=(const unique_ptr<_T1, _D1>& __x, nullptr_t) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/memory:2970:1: note: candidate template ignored: could not match 'unique_ptr<type-parameter-0-0,
      type-parameter-0-1>' against 'nullptr_t'
operator!=(nullptr_t, const unique_ptr<_T1, _D1>& __x) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/memory:4750:1: note: candidate template ignored: could not match 'shared_ptr' against 'basic_string'
operator!=(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/memory:4807:1: note: candidate template ignored: could not match 'shared_ptr' against 'basic_string'
operator!=(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/memory:4815:1: note: candidate template ignored: could not match 'shared_ptr<type-parameter-0-0>' against
      'nullptr_t'
operator!=(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/string_view:640:6: note: candidate template ignored: could not match 'basic_string_view' against 'basic_string'
bool operator!=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
     ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/string_view:649:6: note: candidate template ignored: could not match 'basic_string_view' against 'basic_string'
bool operator!=(basic_string_view<_CharT, _Traits> __lhs,
     ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/string_view:659:6: note: candidate template ignored: could not match 'basic_string_view<type-parameter-0-0,
      type-parameter-0-1>' against 'nullptr_t'
bool operator!=(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs, 
     ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/string:540:6: note: candidate template ignored: could not match 'fpos' against 'basic_string'
bool operator!=(const fpos<_StateT>& __x, const fpos<_StateT>& __y)
     ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/string:3621:1: note: candidate template ignored: could not match 'basic_string<type-parameter-0-0,
      type-parameter-0-1, type-parameter-0-2>' against 'nullptr_t'
operator!=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/string:3630:1: note: candidate template ignored: could not match 'const _CharT *' against
      'std::__1::basic_string<char>'
operator!=(const _CharT* __lhs,
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/string:3639:1: note: candidate template ignored: could not match 'const _CharT *' against 'nullptr_t'
operator!=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/functional:1965:1: note: candidate template ignored: could not match 'function' against 'basic_string'
operator!=(const function<_Rp(_ArgTypes...)>& __f, nullptr_t) _NOEXCEPT {return (bool)__f;}
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/functional:1970:1: note: candidate template ignored: could not match 'function<type-parameter-0-0
      (type-parameter-0-1...)>' against 'nullptr_t'
operator!=(nullptr_t, const function<_Rp(_ArgTypes...)>& __f) _NOEXCEPT {return (bool)__f;}
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/deque:2860:1: note: candidate template ignored: could not match 'deque' against 'basic_string'
operator!=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/list:2379:1: note: candidate template ignored: could not match 'list' against 'basic_string'
operator!=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/vector:3318:1: note: candidate template ignored: could not match 'vector' against 'basic_string'
operator!=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y)
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/map:1416:1: note: candidate template ignored: could not match 'map' against 'basic_string'
operator!=(const map<_Key, _Tp, _Compare, _Allocator>& __x,
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/map:1881:1: note: candidate template ignored: could not match 'multimap' against 'basic_string'
operator!=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/set:763:1: note: candidate template ignored: could not match 'set' against 'basic_string'
operator!=(const set<_Key, _Compare, _Allocator>& __x,
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/set:1173:1: note: candidate template ignored: could not match 'multiset' against 'basic_string'
operator!=(const multiset<_Key, _Compare, _Allocator>& __x,
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/complex:772:1: note: candidate template ignored: could not match 'complex' against 'basic_string'
operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y)
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/complex:780:1: note: candidate template ignored: could not match 'complex' against 'basic_string'
operator!=(const complex<_Tp>& __x, const _Tp& __y)
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/complex:788:1: note: candidate template ignored: could not match 'complex<type-parameter-0-0>' against
      'nullptr_t'
operator!=(const _Tp& __x, const complex<_Tp>& __y)
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/array:241:1: note: candidate template ignored: could not match 'array' against 'basic_string'
operator!=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
^
3 errors generated.
$ clang++ p585a.cpp -std=c++17 -Wall
p585a.cpp:14:5: error: cannot initialize a variable of type 'char *' with an rvalue of type 'int'
any x(5); // x holds int
    ^ ~
p585a.cpp:29:11: error: no viable conversion from 'std::string' (aka 'basic_string<char, char_traits<char>, allocator<char> >') to 'const char *'
const any y(cat); // const y holds string
          ^ ~~~
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/string:823:5: note: candidate function
    operator __self_view() const _NOEXCEPT { return __self_view(data(), size()); }
    ^
p585a.cpp:36:50: error: invalid operands to binary expression ('std::__1::basic_string<char>' and 'nullptr_t')
  return (boost::any_cast<std::string>(&operand) != nullptr);
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/system_error:606:1: note: candidate function not viable: no known conversion from 'std::__1::basic_string<char>'
      to 'const std::__1::error_code' for 1st argument
operator!=(const error_code& __x, const error_code& __y) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/system_error:611:1: note: candidate function not viable: no known conversion from 'std::__1::basic_string<char>'
      to 'const std::__1::error_code' for 1st argument
operator!=(const error_code& __x, const error_condition& __y) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/system_error:616:1: note: candidate function not viable: no known conversion from 'std::__1::basic_string<char>'
      to 'const std::__1::error_condition' for 1st argument
operator!=(const error_condition& __x, const error_code& __y) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/system_error:621:1: note: candidate function not viable: no known conversion from 'std::__1::basic_string<char>'
      to 'const std::__1::error_condition' for 1st argument
operator!=(const error_condition& __x, const error_condition& __y) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:1543:16: note: candidate function not viable: no known conversion from 'std::__1::basic_string<char>' to
      'std::__1::monostate' for 1st argument
constexpr bool operator!=(monostate, monostate) noexcept { return false; }
               ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/utility:564:1: note: candidate template ignored: could not match 'pair' against 'basic_string'
operator!=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/iterator:710:1: note: candidate template ignored: could not match 'reverse_iterator' against 'basic_string'
operator!=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/iterator:932:1: note: candidate template ignored: could not match 'istream_iterator' against 'basic_string'
operator!=(const istream_iterator<_Tp, _CharT, _Traits, _Distance>& __x,
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/iterator:1033:6: note: candidate template ignored: could not match 'istreambuf_iterator' against 'basic_string'
bool operator!=(const istreambuf_iterator<_CharT,_Traits>& __a,
     ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/iterator:1151:1: note: candidate template ignored: could not match 'move_iterator' against 'basic_string'
operator!=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/iterator:1524:1: note: candidate template ignored: could not match '__wrap_iter' against 'basic_string'
operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/iterator:1556:1: note: candidate template ignored: could not match '__wrap_iter' against 'basic_string'
operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT_DEBUG
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/tuple:1152:1: note: candidate template ignored: could not match 'tuple' against 'basic_string'
operator!=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/memory:1965:6: note: candidate template ignored: could not match 'allocator' against 'basic_string'
bool operator!=(const allocator<_Tp>&, const allocator<_Up>&) _NOEXCEPT {return false;}
     ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/memory:2915:1: note: candidate template ignored: could not match 'unique_ptr' against 'basic_string'
operator!=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return !(__x == __y);}
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/memory:2962:1: note: candidate template ignored: could not match 'unique_ptr' against 'basic_string'
operator!=(const unique_ptr<_T1, _D1>& __x, nullptr_t) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/memory:2970:1: note: candidate template ignored: could not match 'unique_ptr<type-parameter-0-0,
      type-parameter-0-1>' against 'nullptr_t'
operator!=(nullptr_t, const unique_ptr<_T1, _D1>& __x) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/memory:4750:1: note: candidate template ignored: could not match 'shared_ptr' against 'basic_string'
operator!=(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/memory:4807:1: note: candidate template ignored: could not match 'shared_ptr' against 'basic_string'
operator!=(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/memory:4815:1: note: candidate template ignored: could not match 'shared_ptr<type-parameter-0-0>' against
      'nullptr_t'
operator!=(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/string_view:640:6: note: candidate template ignored: could not match 'basic_string_view' against 'basic_string'
bool operator!=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
     ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/string_view:649:6: note: candidate template ignored: could not match 'basic_string_view' against 'basic_string'
bool operator!=(basic_string_view<_CharT, _Traits> __lhs,
     ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/string_view:659:6: note: candidate template ignored: could not match 'basic_string_view<type-parameter-0-0,
      type-parameter-0-1>' against 'nullptr_t'
bool operator!=(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs, 
     ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/string:540:6: note: candidate template ignored: could not match 'fpos' against 'basic_string'
bool operator!=(const fpos<_StateT>& __x, const fpos<_StateT>& __y)
     ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/string:3621:1: note: candidate template ignored: could not match 'basic_string<type-parameter-0-0,
      type-parameter-0-1, type-parameter-0-2>' against 'nullptr_t'
operator!=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/string:3630:1: note: candidate template ignored: could not match 'const _CharT *' against
      'std::__1::basic_string<char>'
operator!=(const _CharT* __lhs,
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/string:3639:1: note: candidate template ignored: could not match 'const _CharT *' against 'nullptr_t'
operator!=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/functional:1965:1: note: candidate template ignored: could not match 'function' against 'basic_string'
operator!=(const function<_Rp(_ArgTypes...)>& __f, nullptr_t) _NOEXCEPT {return (bool)__f;}
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/functional:1970:1: note: candidate template ignored: could not match 'function<type-parameter-0-0
      (type-parameter-0-1...)>' against 'nullptr_t'
operator!=(nullptr_t, const function<_Rp(_ArgTypes...)>& __f) _NOEXCEPT {return (bool)__f;}
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/optional:1030:1: note: candidate template ignored: could not match 'optional' against 'basic_string'
operator!=(const optional<_Tp>& __x, const optional<_Up>& __y)
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/optional:1123:1: note: candidate template ignored: could not match 'optional' against 'basic_string'
operator!=(const optional<_Tp>& __x, nullopt_t) noexcept
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/optional:1131:1: note: candidate template ignored: could not match 'optional<type-parameter-0-0>' against
      'nullptr_t'
operator!=(nullopt_t, const optional<_Tp>& __x) noexcept
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/optional:1232:1: note: candidate template ignored: could not match 'optional' against 'basic_string'
operator!=(const optional<_Tp>& __x, const _Up& __v)
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/optional:1244:1: note: candidate template ignored: could not match 'optional<type-parameter-0-1>' against
      'nullptr_t'
operator!=(const _Tp& __v, const optional<_Up>& __x)
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/array:241:1: note: candidate template ignored: could not match 'array' against 'basic_string'
operator!=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:1452:16: note: candidate template ignored: could not match 'variant' against 'basic_string'
constexpr bool operator!=(const variant<_Types...>& __lhs,
               ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/deque:2860:1: note: candidate template ignored: could not match 'deque' against 'basic_string'
operator!=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/list:2379:1: note: candidate template ignored: could not match 'list' against 'basic_string'
operator!=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/vector:3318:1: note: candidate template ignored: could not match 'vector' against 'basic_string'
operator!=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y)
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/map:1416:1: note: candidate template ignored: could not match 'map' against 'basic_string'
operator!=(const map<_Key, _Tp, _Compare, _Allocator>& __x,
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/map:1881:1: note: candidate template ignored: could not match 'multimap' against 'basic_string'
operator!=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/set:763:1: note: candidate template ignored: could not match 'set' against 'basic_string'
operator!=(const set<_Key, _Compare, _Allocator>& __x,
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/set:1173:1: note: candidate template ignored: could not match 'multiset' against 'basic_string'
operator!=(const multiset<_Key, _Compare, _Allocator>& __x,
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/complex:772:1: note: candidate template ignored: could not match 'complex' against 'basic_string'
operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y)
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/complex:780:1: note: candidate template ignored: could not match 'complex' against 'basic_string'
operator!=(const complex<_Tp>& __x, const _Tp& __y)
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/complex:788:1: note: candidate template ignored: could not match 'complex<type-parameter-0-0>' against
      'nullptr_t'
operator!=(const _Tp& __x, const complex<_Tp>& __y)
^
3 errors generated.

$ g++-7 p585a.cpp -std=c++03  -Wall
p585a.cpp:9:10: fatal error: boost/any.hpp: No such file or directory
 #include <boost/any.hpp>
          ^~~~~~~~~~~~~~~
compilation terminated.

$ g++-7 p585a.cpp -std=c++11  -Wall
p585a.cpp:9:10: fatal error: boost/any.hpp: No such file or directory
 #include <boost/any.hpp>
          ^~~~~~~~~~~~~~~
compilation terminated.

$ g++-7 p585a.cpp -std=c++17  -Wall
p585a.cpp:9:10: fatal error: boost/any.hpp: No such file or directory
 #include <boost/any.hpp>
          ^~~~~~~~~~~~~~~
compilation terminated.

#検討事項(agenda)
エラー3つ取れない。
役に立つまたは意味のある出力

#参考資料(reference)

N4606 Working Draft 2016, ISO/IEC 14882, C++ standardのコード断片をコンパイルするためにしていること
https://qiita.com/kaizen_nagoya/items/a8d7ee2f2e29e76c19c1

コンパイル用shell script C版(clangとgcc)とC++版(clang++とg++)
https://qiita.com/kaizen_nagoya/items/74220c0577a512c2d7da

Clang/Clang++(LLVM) gcc/g++(GNU) コンパイラ警告等比較
https://qiita.com/kaizen_nagoya/items/9a82b958cc3aeef0403f

C++2003とC++2017でコンパイルエラーになるならない事例集
https://qiita.com/kaizen_nagoya/items/a13ea3823441c430edff

Qiitaに投稿するCのStyle例(暫定)
https://qiita.com/kaizen_nagoya/items/946df1528a6a1ef2bc0d

cpprefjpのdecltypeをコンパイル試験
https://qiita.com/kaizen_nagoya/items/090909af702f0d5d8a67

MISRA C++ 5-0-16
https://qiita.com/kaizen_nagoya/items/7df2d4e05db724752a74

C++ Templates Part1 BASICS Chapter 3. Class Templates 3.2 Use of Class Template Stack stack1test.cpp
https://qiita.com/kaizen_nagoya/items/cd5fc49106fad5a4e9ed

ISO/IEC TS 17961:2013 C Secure Coding Rules(1) All list(to be confirmed)
https://qiita.com/kaizen_nagoya/items/54e056195c4f11b850a1

C言語(C++)に対する誤解、曲解、無理解、爽快。
https://qiita.com/kaizen_nagoya/items/3f3992c9722c1cee2e3a

C Puzzle Bookの有り難み5つ、C言語規格及びCコンパイラの特性を認識
https://qiita.com/kaizen_nagoya/items/d89a48c1536a02ecdec9

'wchar.h' file not found で困った clang++ macOS
https://qiita.com/kaizen_nagoya/items/de15cd46d657517fac11

Open POSIX Test Suiteの使い方を調べはじめました
https://qiita.com/kaizen_nagoya/items/644d5e407f5faf96e6dc

MISRA-C 2012 Referenceに掲載している文献の入手可能性を確認
https://qiita.com/kaizen_nagoya/items/96dc8b125e462d5575bb

どうやって MISRA Example Suiteをコンパイルするか
https://qiita.com/kaizen_nagoya/items/fbdbff5ff696e2ca7f00

MISRA C まとめ #include
https://qiita.com/kaizen_nagoya/items/f1a79a7cbd281607c7c9

「C++完全理解ガイド」の同意できること上位10
https://qiita.com/kaizen_nagoya/items/aa5744e0c4a8618c7671

#文書履歴(document history)
ver. 0.10 初稿 20180430

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?