This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++ PATCH for c++/70353 (core issue 1962)


On 2016.03.25 at 17:29 -0400, Jason Merrill wrote:
> 70353 is a problem with the function-local static declaration of __func__.
> Normally constexpr functions can't have local statics, so this is only an
> issue with __func__.  Meanwhile, core issue 1962 looks like it's going to be
> resolved by changing __func__ et al to be prvalue constants of type const
> char * rather than static local array variables, so implementing that
> proposed resolution also resolves this issue, as well as 62466 which
> complains about the strings not being merged between translation units.
> This patch proceeds from Martin's work last year.
> 
> Tested x86_64-pc-linux-gnu, applying to trunk.

It breaks building Firefox:

trippels@gcc2-power8 places % cat nsNavHistory.ii
struct A {
  template <int N> A(const char (&)[N]);
};
void fn1() { A(__func__); }


trippels@gcc2-power8 places % c++  -c nsNavHistory.ii
nsNavHistory.ii: In function âvoid fn1()â:
nsNavHistory.ii:4:24: error: no matching function for call to âA::A(const char*&)â
 void fn1() { A(__func__); }
                        ^
nsNavHistory.ii:2:20: note: candidate: template<int N> A::A(const char (&)[N])
   template <int N> A(const char (&)[N]);
                    ^
nsNavHistory.ii:2:20: note:   template argument deduction/substitution failed:
nsNavHistory.ii:4:24: note:   mismatched types âconst char [N]â and âconst char*â
 void fn1() { A(__func__); }
                        ^
nsNavHistory.ii:1:8: note: candidate: constexpr A::A(const A&)
 struct A {
        ^
nsNavHistory.ii:1:8: note:   no known conversion for argument 1 from âconst char*â to âconst A&â
nsNavHistory.ii:1:8: note: candidate: constexpr A::A(A&&)
nsNavHistory.ii:1:8: note:   no known conversion for argument 1 from âconst char*â to âA&&â

So I'm not sure if your patch is really appropriate at this time.
Maybe waiting until next stage 1 would be better?

-- 
Markus


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]