[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#833931: c++: Fail to build when <stdnoreturn.h> and the noreturn keyword is used



Control: reopen -1
Control: reassign -1 g++-8
Control: found -1 8.2.0-14

I had a look, and this issue still exist with GCC 8.2.  Reassigning as
appropriate.

% gcc c++-noreturn.c 
c++-noreturn.c: In function 'stop_now':
c++-noreturn.c:10:1: warning: 'noreturn' function does return
 }
 ^
% clang c++-noreturn.c 
c++-noreturn.c:10:1: warning: function declared 'noreturn' should not return [-Winvalid-noreturn]
}
^
1 warning generated.
% c++ c++-noreturn.c 
c++-noreturn.c:7:1: error: 'noreturn' does not name a type
 noreturn void stop_now(int i) // or _Noreturn void stop_now(int i)
 ^~~~~~~~
c++-noreturn.c: In function 'int main()':
c++-noreturn.c:15:3: error: 'stop_now' was not declared in this scope
   stop_now(2);
   ^~~~~~~~
% c++ --version
c++ (Debian 8.2.0-14) 8.2.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

%

-- 
Happy hacking
Petter Reinholdtsen


Reply to: