[Bug c++/47774] [C++0x] constexpr specifier on ctor not ignored when template instantiation causes ctor to not satify constexpr requirements
dev.lists at jessamine dot co.uk
gcc-bugzilla@gcc.gnu.org
Wed Feb 16 23:12:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47774
--- Comment #1 from Adam Butcher <dev.lists at jessamine dot co.uk> 2011-02-16 23:03:22 UTC ---
Created attachment 23369
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23369
Various declarations and constexpr specifications demonstrating problem --
runnable as sh script
Added an additional test file, runnable as sh script, which tests various
combinations of ctor specifications and member types.
Compiling with gcc version 4.6.0 20110216 (experimental) (GCC) built tonight
yields:
$ sh constexpr-ctor-templ.cpp
+ g++ -c constexpr-ctor-templ.cpp -std=c++0x -DPLAIN_T -DUSE_SYNTHESIZED_X_CTOR
--------------------------------------------
+ g++ -c constexpr-ctor-templ.cpp -std=c++0x -DPLAIN_T
-DGIVE_X_EXPLICIT_CONSTEXPR_CTOR
--------------------------------------------
+ g++ -c constexpr-ctor-templ.cpp -std=c++0x -DPLAIN_T
-DGIVE_X_EXPLICIT_CONSTEXPR_CTOR
--------------------------------------------
+ g++ -c constexpr-ctor-templ.cpp -std=c++0x -DPLAIN_T_ARRAY
-DUSE_SYNTHESIZED_X_CTOR
--------------------------------------------
+ g++ -c constexpr-ctor-templ.cpp -std=c++0x -DPLAIN_T_ARRAY
-DGIVE_X_EXPLICIT_CONSTEXPR_CTOR
constexpr-ctor-templ.cpp: In constructor ‘constexpr X<T>::X() [with T =
ncbool]’:
constexpr-ctor-templ.cpp:148:14: instantiated from here
constexpr-ctor-templ.cpp:103:24: error: ‘ncbool::ncbool(bool)’ is not
‘constexpr’
--------------------------------------------
+ g++ -c constexpr-ctor-templ.cpp -std=c++0x -DPLAIN_T_ARRAY
-DGIVE_X_EXPLICIT_CONSTEXPR_CTOR
constexpr-ctor-templ.cpp: In constructor ‘constexpr X<T>::X() [with T =
ncbool]’:
constexpr-ctor-templ.cpp:148:14: instantiated from here
constexpr-ctor-templ.cpp:103:24: error: ‘ncbool::ncbool(bool)’ is not
‘constexpr’
--------------------------------------------
+ g++ -c constexpr-ctor-templ.cpp -std=c++0x -DFLAG_T -DUSE_SYNTHESIZED_X_CTOR
constexpr-ctor-templ.cpp: In constructor ‘X<ncbool>::X()’:
constexpr-ctor-templ.cpp:100:8: error: ‘constexpr flag<BoolType>::flag(bool)
[with BoolType = ncbool]’ is not ‘constexpr’
constexpr-ctor-templ.cpp: In function ‘int main(int, char**)’:
constexpr-ctor-templ.cpp:148:14: note: synthesized method ‘X<ncbool>::X()’
first required here
--------------------------------------------
+ g++ -c constexpr-ctor-templ.cpp -std=c++0x -DFLAG_T
-DGIVE_X_EXPLICIT_CONSTEXPR_CTOR
--------------------------------------------
+ g++ -c constexpr-ctor-templ.cpp -std=c++0x -DFLAG_T
-DGIVE_X_EXPLICIT_CONSTEXPR_CTOR
--------------------------------------------
+ g++ -c constexpr-ctor-templ.cpp -std=c++0x -DFLAG_T_ARRAY
-DUSE_SYNTHESIZED_X_CTOR
constexpr-ctor-templ.cpp: In constructor ‘constexpr X<ncbool>::X()’:
constexpr-ctor-templ.cpp:100:8: error: ‘constexpr flag<BoolType>::flag(bool)
[with BoolType = ncbool]’ is not ‘constexpr’
constexpr-ctor-templ.cpp:100:8: error: non-constant array initialization
constexpr-ctor-templ.cpp: In function ‘int main(int, char**)’:
constexpr-ctor-templ.cpp:148:14: note: synthesized method ‘X<ncbool>::X()’
first required here
--------------------------------------------
+ g++ -c constexpr-ctor-templ.cpp -std=c++0x -DFLAG_T_ARRAY
-DGIVE_X_EXPLICIT_CONSTEXPR_CTOR
constexpr-ctor-templ.cpp: In constructor ‘constexpr X<T>::X() [with T =
ncbool]’:
constexpr-ctor-templ.cpp:148:14: instantiated from here
constexpr-ctor-templ.cpp:103:24: error: ‘constexpr flag<BoolType>::flag(bool)
[with BoolType = ncbool]’ is not ‘constexpr’
--------------------------------------------
+ g++ -c constexpr-ctor-templ.cpp -std=c++0x -DFLAG_T_ARRAY
-DGIVE_X_EXPLICIT_CONSTEXPR_CTOR
constexpr-ctor-templ.cpp: In constructor ‘constexpr X<T>::X() [with T =
ncbool]’:
constexpr-ctor-templ.cpp:148:14: instantiated from here
constexpr-ctor-templ.cpp:103:24: error: ‘constexpr flag<BoolType>::flag(bool)
[with BoolType = ncbool]’ is not ‘constexpr’
--------------------------------------------
Failed 6
More information about the Gcc-bugs
mailing list