https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107782

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|https://gcc.gnu.org/bugzill |
                   |a/show_bug.cgi?id=87497,    |
                   |https://gcc.gnu.org/bugzill |
                   |a/show_bug.cgi?id=89553     |
             Status|UNCONFIRMED                 |NEW
            Summary|constexpr volatile variable |a local constexpr volatile
                   |is permitted to appear in a |variable cannot be used to
                   |constant expression         |initialize a local
                   |                            |constexpr volatile variable
   Last reconfirmed|                            |2022-11-21
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed. 
Note GCC only does NOT rejects the local variable case.

That is take:
int main() {
  constexpr volatile int t = 1;
  static constexpr volatile int t1 = t;
  constexpr volatile int t2 = t;
  constexpr int t3 = t;
};

GCC will reject t1 and t3 correctly but not t2.
So GCC is mostly correct except for that one case while MSVC accepts all of the
above.

Reply via email to