You should avoid putting formatting in the argument (not least because it will affect tables of contents and "named" cross referencing.)
there are several ways of specifying the heading format for example the titlesec
package:
\documentclass[12pt, a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage{titlesec}
\titleformat{\chapter}[block]
{\normalfont\huge\bfseries}{\thechapter}{1em}{\Huge\MakeUppercase}
\begin{document}
\tableofcontents
\chapter{Foo\\bar}
\end{document}
The standard layout of the book class is obtained with
\documentclass[12pt, a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage{titlesec}
\titleformat{\chapter}[display]
{\normalfont\huge\bfseries}
{\MakeUppercase{\chaptertitlename}\ \thechapter}
{1em}
{\Huge\MakeUppercase}
\begin{document}
\tableofcontents
\chapter{Foo\\bar}
\end{document}
\chapter
argument.\\
causes problems here. You can use\chapter{\upper{Foo \protect\\ bar}}
but that would issue a line-break in the ToC also. Instead just use\chapter[Foo bar]{\upper{Foo \protect\\ bar}}
if you must.\expandafter
are doing nothing as once#1
is inserted it is\expandafter\MakeUppercase\expandafter{Foo bar}
so the\expandafter
are applied to the tokenF
which is not expandable.