<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - static_assert does not respect new-lines"
   href="https://llvm.org/bugs/show_bug.cgi?id=26225">26225</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>static_assert does not respect new-lines
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>metaprogrammingtheworld@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This may or may not be considered a bug -- when a static_assert message
contains a '\n' character, the text "\n" is currently printed as opposed to an
actual new line. This is more unfortunate than it might seem because spacing
and new lines in static_assert messages can greatly improve the readability of
user-provided error messages.

Notably, GCC prints an actual new line when the new-line character is
encountered.

Example:

////////////////////
static_assert(false,
  "\n****************************************\n"
  "Error: The third macro argument that was "
  "provided to FOO is invalid (it was not parenthesized). Saw:\n"
  "std::array<int, 5>\n"
  "Did you mean:\n"
  "(std::array<int, 5>)"
  "\n****************************************\n");

int main() {}
////////////////////

In GCC, this nicely prints:

1 : error: static assertion failed:
****************************************
Error: The third macro argument that was provided to FOO is invalid (it was not
parenthesized). Saw:
std::array<int, 5>
Did you mean:
(std::array<int, 5>)
****************************************

While in Clang, this prints:

1 : error: static_assert failed
"\n****************************************\nError: The third macro argument
that was provided to FOO is invalid (it was not parenthesized).
Saw:\nstd::array<int, 5>\nDid you mean:\n(std::array<int,
5>)\n****************************************\n"</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>